Tag: Patterns
-
Prototypical inheritance in JavaScript
Read full post on falafel blog Before we can understand prototypical inheritance, let us start with a problem statement. You have a student for whom you need to: Calculate their grade Print the grade In JavaScript this can be simply implemented as follows: There are some inherent problems in the above approach: Variables are defined…
-
Decorator Pattern in C#
Read full article on Falafel blog “Decorator pattern attach additional functionalities or responsibilities to an existing object at the runtime”. It adds new behaviour to an individual object without affecting other objects of the same class. New behaviour or functionalities can be either added dynamically at the run time or statically. The decorator pattern: ·…
-
Keep your code DRY
Other day my Boss was reviewing the code written by me. He had a feedback, keep the code DRY. It was great feedback, and I thought why not to share with you that what does DRY mean? DRY stands for Do not Repeat Yourself. To understand it better let is consider below code snippet: I…
-
Revealing Module Pattern in JavaScript
We talked about Prototype Pattern in previous posts. You can read them at below link. Understanding Prototype Pattern in JavaScript Understanding Prototype Pattern in JavaScript: Part # 2 Revealing Module Pattern allows us to achieve Singleton object Private Public behaviour of functions and properties in the object. Let us consider the usual code we write.…