0%

PImpl Idiom

  • The PImpl Idiom (Pointer to IMPLementation) is a technique used for separating implementation from the interface. It minimizes header exposure and helps programmers to reduce build dependencies by moving the private data members in a separate class and accessing them through an opaque pointer.
  • Advantages: Binary Compatibility, Less compilation time (Only the implementation file needs to be rebuild), Data Hiding
  • Disadvantages: More memory allocation than with the default structure, More complex maintenance, Inheritance problem

RAII

  • Resource Acquisition is Initialization binds the life cycle of a resource that must be acquired before use (allocated heap memory, thread of execution, open socket, open file, locked mutex, disk space, database connection and etc.) to the lifetime of an object.
  • It also guarantees that all resources are released when the lifetime of their controlling object ends, in reverse order of acquisition.

const

  • const int * abc: Declares that the abc is a variable pointer to a constant integer.
  • int const * abc: Also declares that the abc is a variable pointer to a constant integer.
  • int * const abc: A const pointer to a variable integer. Useful for storage that can be changed in value but not moved in memory.
  • int const * const abc: A const pointer to a const integer.

    Parameter passing

  • void Subroutine(big_structure_type &Parameter);
  • Using & maybe because it is going to alter the variable passed to it or might just be to save copying time and there is no way to tell which it is.
  • In this case, we could use the following signature for the second situation: void Subroutine(big_structure_type const &Parameter).

    Object Oriented Programming

  • 1
    2
    3
    class Class2{ 
    void Method1() const;
    int MemberVariable1;}
  • Which will ban Method1 in Class2 from being anything which can attempt to alter any member variables in the object.
  • Method1 could be called without having an object of Class2

    constexpr

  • The constexpr specifier declares that it is possible to evaluate the value of the function or variable at compile time. Such variables and functions can then be used where only compile time constant expressions are allowed.
Read more »

Class

  • “Instantiating” a class in JavaScript does create a new object, but not one that is independent of its parent class. Rather, it creates an object that is linked to a prototype. Changes to that prototype propagate to the new object, even after instantiation.

  • Classes can only contain method definitions, not data properties;

  • A derived class can’t contain an empty constructor. Even if all the constructor does is call super(), you’ll still have to do so explicitly. It can, however, contain no constructor.

  • You must call super in the constructor of a derived class before you use this.

  • Calling any function with the new keyword causes it to return an object – this is called making a constructor call, and such functions are generally called constructors: When you call a function with new, four things happen under the hood:

    • A new object gets created (let’s call it O);
    • O gets linked to another object, called its prototype;
    • The function’s this value is set to refer to O;
    • The function implicitly returns O.
Read more »

Testing

  • Testing is a whole-team responsibility
  • Different roles and different testings:
    • Developers: unit, integration, system, acceptance
    • Disigners: integration
    • Customers: acceptance
    • Analysts: acceptance
    • Test engineers and QA team: system, acceptance, exploratory
    • End Users: beta
    • Architects: integration, system
  • Varification: Software is right; Validation: We build the right software.
  • Fault (Also called defect, testing is aim to reveal this) -> Error -> Failure (Test will cause this)
    Read more »