Browsing Category

Tutoriale


VIEW POST

View more
Tutoriale

Singleton done right in C++ 11

By on 11/07/2017

Today searching the internet I’ve found a “cool” and simple method to create a safe singleton that performs well in multithreading environment.

With a small amount of lines you can achieve both: safe initialization and multithreading safety.
class Singleton {
static std::once_flag onceFlag;


VIEW POST

View more
Tutoriale

The PIMPL idiom

By on 14/01/2017

The purpose

Remove compilation dependencies on internal class implementations and improve compile times.

The story behind

When a header file changes, any files that #include that file will need to be recompiled. In the case of a class header, this is true even if those changes only apply to private members of…


VIEW POST

View more
Tutoriale

Inheritance in C++

By on 07/01/2017

The question:
I looked and couldn’t find a good explanation of the difference between public, private, and protected inheritance in C++. All of the questions I’ve found deal with specific cases. What is the difference in general?
The answer:
There are three accessors that I’m aware of: public, protected and private.

Lets take…


VIEW POST

View more
Tutoriale

Testarea unui singleton folosind Mock Object

By on 10/07/2016

Problema

De multe ori testarea singleton-urilor este una foarte anevoioasa. Folosirea acestui pattern pe langa ca aduce multa simplitate in ceea ce priveste accesul la variabilele protejate de singleton ingreuneaza testarea codului.

Urmatorul cod prezinta solutia clasica, si nu neaparat cea mai buna, de implementare a unui singleton:

class Singleton
{
public:


VIEW POST

View more
Tutoriale

Factory Method Design Pattern

By on 04/07/2016

Dupa singleton, un alt pattern destul de des folosit in crearea obiectelor este cel denumit “factory method”. Pe scurt acesta izoleaza partea de creare si parametrizare a unui obiect intr-o metoda statica ce are rolul, initial, de a crea obiectul iar mai apoi de a-l parametriza facandu-l gata pentru…


VIEW POST

View more
Tutoriale

Singleton Pattern

By on 26/06/2016

Singleton sau “instanta unica” este un design pattern creational. Acesta constrange numarul obiectelor pe care o clasa le defineste.┬áSingleton-ul este frecvent intalnit la definirea accesului la resurse “unice” in sistem precum:

baze de date
resurse hardware (registri, componente harware: modem, gps, gprs …)

Problema
Vorbim aici de existenta unei aplicatii ce…

VLAD VESA
Timisoara, RO

Hi my name is Vlad and this is my Journey! I use this awesome blog theme to tell people my story. Through all the places and things I see around the world, there isn't a better way to share my experience! Follow my daily updates and discover with me the essence of traveling!

Latest tweets
  • Trying out @theTunnelBear so I can browse privately from my ISP https://t.co/nTKZxipi9d https://t.co/nGJHmMue9O

    Tweeted on 10:41 PM Oct 27

  • just bought a @lenovo yoga 720 beautiful machine! good build quality and unexpected package content! https://t.co/nNHj7WCK6A

    Tweeted on 10:13 PM Oct 27