RSA – explained. Part 1.

RSA a milestone in cryptography, was first published by Ron Rivest, Adi Shamir and Leonard Adleman (MIT) in 1977. Their work based heavily on idea of asymmetric public-private key cryptosystem published in 1976 by Whitfield Diffie and Martin Hellman (Stanford). Here I try to make simple explanation of that cipher (not to pretend I am […]

Design Patterns

Design Patterns Design Patterns: Elements of Reusable Object-Oriented Software is a software engineering book describing software design patterns. The book’s authors are Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of […]

Command pattern

1. Usage Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. The purpose of the Command pattern is to decouple an event generator (the Invoker) from the event handler (the Receiver). A ConcreteCommand class (sub-classed from Command) defines an execute ()method which […]

Iterator pattern

1. Usage Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. makes possible to decouple collection classes and algorithms. Promote to “full object status” the traversal of a collection. Polymorphic traversal 2. UML class diagram 3. Pros shields the client from the internal representation of aggregator. aggregate […]

Interpreter pattern

1. Usage Specialized database query languages such as SQL,RegExp. Specialized computer languages which are often used to describe communication protocols. Most general-purpose computer languages actually incorporate several specialized languages.(lua script inside game engine) 2. UML class diagram AbstractExpression Declares an abstract Interpret operation that is common to all nodes in the abstract syntax tree. TerminalExpression […]

Memento pattern

1. Usage Saves inner state of object in order to restore it in future. Usually implemented in Undo/Redo of Editors sometimes with Command Pattern. Memento in C++ implemented as Friend of Originator. Originator hide details of Memento providing narrow interface for controls. 2. UML class diagram Originator (managed a contained Memento obj), Memento(snapshot of originator […]

Chain of responsibility pattern

1. Usage Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. [GoF, p223] Launch-and-leave requests with a single processing pipeline that contains many possible handlers. An […]

Decorator

1. Usage Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. [GoF, p175] Client-specified embellishment of a core object by recursively wrapping it. Wrapping a gift, putting it in a box, and wrapping the box. 2. UML class diagram 3. Pros Decorators provide a flexible alternative to […]