Few Software Principles

>>> Law of Demeter – ONLY TALK TO YOUR IMMEDIATE FRIENDS

The Law of Demeter for functions requires that a method M of an object O may only invoke the methods of the following kinds of object

O itself,  M’s parameters, any objects created/instantiated, within M O’s direct component objects

       In particular, an object should avoid invoking methods of a member object returned by another method. For many modern object oriented languages that use a dot as field identifier, the law can be stated simply as “use only one dot”. That is, the code “a.b.Method()” breaks the law where “a.Method()” does not. There is disagreement as to the sufficiency of this approach

>>> Open/Closed Principle – OPEN FOR EXTENSIONS, CLOSED FOR MODIFICATIONS

         The open/closed principle states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification, that is, such an entity can allow its behaviour to be modified without altering its source code

>>> Fragile base Class Problem :

        It is a fundamental architectural problem of object-oriented programming systems where base classes (superclasses) are considered “fragile” because seemingly safe modifications to a base class, when inherited by the derived classes, may cause the derived classes to malfunction. The programmer cannot determine whether a base class change is safe simply by examining in isolation the methods of the base class.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s