Author image

Adapter/Wrapper/Facade Design Pattern

Here we will disambiguate the Adapter Wrapper Facade Software Design patterns.

A confused pattern, yes.
It has many names.
Adapter, Facade, Wrapper.
But they're all pretty much the same..

The Adapter (aka Facade aka Wrapper class) wraps a legacy class with a new interface into an updated class that respects the new interface.

It is most often used to make existing classes work with others (perhaps new ones) without modifying their source code. Many Windows WinAPI functions are an example of this.


  • an interface (perhaps legacy) is not compatible with the current system needs
  • an abstract base class is created that specifies the desired interface
  • an adapter class is defined that publicly inherits the interface of the abstract class, and privately inherits the implementation of the legacy class
  • this adapter class “(impedance) matches”...

Author image

Pointer to Implementation (Pimpl) - Bridge Design Pattern

In the non-C++ world Pimpl is also known as the Bridge design pattern, with the following definition:

Decouple an abstraction from its implementation so that the two can be extended independently.

in the vain of Bridge, in C++, when anything in a header file class definition changes, all users of that class must be recompiled - even if the only change was to the private class members that the users/clients of the class cannot even access. This is because C++'s build model is based on textual inclusion, and because C++ assumes that callers know two main things about a class that can be affected by private members: 1. Size and Layout 2. Functions

Because private data members of a class participate in its object representation, affecting size and layout, and because private member functions of a class participate in overload resolution (which takes place before member access checking), any change to those implementation...

Author image

Prototype Design Pattern

Implementing Prototype Design Pattern like a boss and then laughing it off.
Bonus: lewd way of spawning arrays of objects from a prototypical instance (check spawnMonsterArray).

The prototype pattern is a creational software design pattern, that is used when the type of object(s) to create is determined by a prototypical instance, which is cloned to produce new objects. This pattern is used to:

  • avoid subclasses of an object creator, like the factory pattern does
  • avoid the inherent cost of creating a new object in the standard way (like using new) when it can be prohibitively expensive for a given application


  • define an abstract Prototype class with a clone() method that returns a copy of itself
  • create subclasses of Prototype . These will...

Author image

Builder Design Pattern

An introduction to the Builder software design pattern, along with a fancy example you will go from Zero-to-Hero in no time, with this pattern!

The Builder pattern is designed to provide a flexible solution to various object creation problems in OOP. We intend to separate the construction of a complex object from its representation.


It provides control over the individual steps in the object construction process such that we can better customize object representation. The benefits of the builder design pattern really shine when we have big complicated classes.


It requires a separate Builder class for each type of such complex object and it makes dependency injection harder to work with since introducing many dependencies can get things out of hand.

Also it increases code size and almost doubles the amount of memory required since almost all variables...

Author image

Factory Design Pattern


Define an interface for creating an object, but let subclasses decide which class to instantiate.


The factory function is used to create an object of any type of subclass of a base class.
Instead of creating objects like this:

ObjectType* o = new SubObjectType{args};

we create them like this:

ObjectType* o = newSubObjectType{args};

Where newSubObjectType is the factory function's name. Yes, the factory is nothing more but a construction function for objects; it's typically a global/free function (not a method).


  • Create your class hierarchy.
  • The factory function returns one of several possible classes that share a common base class.

The factory design pattern makes a, sort of,...

Author image

Alien Space Battle - Space Invaders lookalike Game

A 2d Space Invaders game clone.

Wanting to get more familiar with Pygame - a very popular Python game library I made this. Pygame hides many of the down and dirty implementation details and all you're basically left to do is create the game logic. If you want to do something similar this project will surely help you.

Author image

Memory Allocators Galore

Allocators are strange creatures in the C++ bestiary, but they are very interesting and understanding them provides you with a deep insight into the language's internals. Are you fascinated by memory allocation in the lower level? Well you've come to the right.

This projects surrounds my efforts around creating some of the most popular memory allocators and it will serve as a reference thenceforth:

  1. Pre-C++11 default allocator (DefaultAllocator & TrackingAllocator projects)
  2. C++11 compatible allocator replacements (Allocators & AlignedAllocator projects)
  3. Linear (aka Arena) allocator (LinearAllocatorproject)
  4. Stack...

Author image

Buffer Overflow

This is a Buffer overflow tutorial using linux Ubuntu and C programming. There is full explanation and code in Greek only at the moment in “Nikos_Lazaridis_M1485_Project#2_ΥΣ13_ΕΑΡΙΝΟ_2017.pdf”. I may become motivated to translate this in English If I get enough requests.

! During Buffer Overflow:
The ultimate goal of a Buffer overflow attack is replacing the return address of a vulnerable/unsecure function with another one of our choosing. The latter function will have "ASCII shellcode" placed into it, which will execute the attacker's desired code (WE are the attacker here); the sky's the limit here with what the attacker can do (more like the imagination of the attacker). “Buffer Overflow” occurs the moment where a single byte is written in the...

Author image

VHDL Decoder 3to8

This is a quite old (circa 2014) university project of mine.

This project entails assembling a hardware decoder circuit with 3 input & 8 outputs in VHDL and simulating it using Altera's Quartus II software.

Author image

Code Injection

Code injection is a technique where you can insert code into a process and then reroute its execution to traverse through your injected custom code segment.

Working from a debugger eg. OllyDbg, we can search for “code caves”, ie. sequences of nop (or "DB 00" in Olly) instructions that are large enough to "fit" our custom code.

Alternatively we can also allocate more memory in the target process to store the code. This is what we will do in this case.

One of the best ways to inject code is via dlls, because they are meant to be loaded by multiple processes at runtime.

Compulsory ingredients:

  1. injector process - DLLInjector project - the process that will "inject" the code
  2. the process to inject - ProcessToInject project - the process...

1 2 3 4 ... 7