Proxy Pattern

This is not same as Bridge Pattern. “Provide a surrogate or placeholder for another object to control access to it” is the intent provided by GoF.   When to use this pattern? Proxy pattern is used when we need to create a wrapper to cover the main object’s complexity from the client. Types of proxies Remote… Continue reading Proxy Pattern

Advertisements

Facade Pattern

The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs. In its general form, the LoD is a specific case of loose coupling. The guideline was proposed by Ian Holland at Northeastern University towards the end of 1987, and can be succinctly summarized in each of the following ways: Each unit should have only… Continue reading Facade Pattern

Mysql – Having

As per SQL standard - The HAVING clause without a GROUP BY clause acts like the WHERE clause. If the HAVING clause contains no aggregate functions, use the WHERE clause for faster performance. SO Link here's an example of a SQL statement where we use HAVING: select column1 from table1 where condition1 having condition2; isn't it the same exact thing if we do this: select column1 from… Continue reading Mysql – Having

PHP 7 New Features

Link, Lynda.com VideoLynda.com Video Major Feature Scalar type hints Type hints have been available in PHP for while now. Unfortunately they were restricted to classes, arrays and callables. As of PHP 7, the scalar types (integers, floating point numbers, booleans and strings) can also be used as type hints. By default “coercive mode” is enabled. This restricts PHP from throwing a type… Continue reading PHP 7 New Features

PHP Magic Method

Link __set and __get PHP provides a pair of magic methods that deal with non-existent or private property access: The __get() method is called whenever you attempt to read a non-existing or private property of an object. The __set() method is called whenever you attempt to write to a non-existing or private property of an object. Code __call  Similar… Continue reading PHP Magic Method

JSON vs XML

One of the most obvious of these is that JSON is significantly less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:”… Continue reading JSON vs XML

OOPS Basic

  The four principles of OOP. 1. Encapsulation 2. Abstraction 3. Inheritance 4. Polymorphism Inheritance is a mechanism of acquiring the features and behaviors of a class by another class. The class whose members are inherited is called the base class, and the class that inherits those members is called the derived class. Inheritance implements… Continue reading OOPS Basic

Design a highly consistent and is network partition tolerant DB

Link to original IntervieBit article Q: What is the amount of data that we need to store?  Anwer: Let's assume a few 100 TB. Q: Do we need to support updates?  A: Yes. Q: Can the size of the value for a key increase with updates?  A: Yes. In other words, its possible a sequence of keys could co-exist on one server previously,… Continue reading Design a highly consistent and is network partition tolerant DB