Click here to Skip to main content
Click here to Skip to main content

IDEAL CHALK - mnemonic acronym and mnemonic images for Object Oriented Principles (OOP)

, 5 Mar 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
IDEAL CHALK - mnemonic acronym and mnemonic images for Object Oriented Principles (OOP) other than SOLID principles

IDEAL CHALK - Mnemonic Acronym and mnemonic Images for Object Oriented Principles

Introduction

The objective of this article is to present mnemonic acronym, mnemonic images and tag lines for easy remembrance of Object Oriented Principles other than the SOLID object oriented principles.

The object oriented principles SOLID, introduced by Robert C Martin, are well known and easy to remember in the acronym form SOLID. The easy remembrance of the principles will aid and prompt the programmer in application of those principles in programming. Apart from the SOLID principles there are several other principles which are also relevant in the Object Oriented programming. If these principles are put in an acronym form, the remembrance and application of these principles in the programming can be made easy to the programmers. After trying for some time I have created an acronym for these principles as shown below:

INIicon INI program to Interface Not Implementation
DRYicon DRY

Don't Repeat Yourself

EWVicon EWV

Encapsulate What Varies

ANCicon ANC

depend on Abstractions, Not Concrete classes

LKPicon LKP

Least Knowledge Principle

COIicon COI

favour Composition Over Inheritance

HOPicon HOP

HOllywood Principle

ADPicon ADP

Apply Design Pattern wherever possible

LCSicon LCS

Strive for Loosely Coupled System

KISSicon KISS

Keep it Simple and Sweet / Stupid

Further, a sentence is formed by connecting the keywords of the principles as follows:

Interfaces Don't repeat Encapsulated Abstractions with Least knowledge of Composition of Hollywood principle Adopted Loosely to Keep it simple.

Since these principles are in addition to the SOLID principles, we can say, write SOLID object oriented programs with IDEAL CHALK. Human brain is good at remembering the images rather than words. The old adage is that "A picture is worth a thousand words". I have created a mnemonic image for each of the object oriented principles.

INI - program to Interface Not Implementation

INI

DRY - Don't Repeat Yourself

DRY

EWV - Encapsulate What Varies

EWV

ANC - depend on Abstractions, Not Concrete classes

ANC

LKP - Least Knowledge Principle

LKP

COI - favour Composition Over Inheritance

COI

HOP - HOllywood Principle

HOP

ADP - Apply Design Pattern wherever possible

ADP

LCS - Strive for Loosely Coupled System

LCS

KISS - Keep it Simple and Sweet / Stupid

KISS

Here's a talk between OO guru and the Programmer 

OO Guru Hi! Programmer.
Use program to Interface not Implementation (INI) principle and do program to IView so that we can use it for desktop (windows forms) application and web forms applications. Do program to IView so that we can use it for desktop (windows forms) application and web forms applications. Think what to do, not who does it.
Programmer OK. Don't Repeat Yourself.
OO Guru That's good. You have said the next OO principle. Don't Repeat Yourself (DRY). Change shall be made only at one place in the program. It should be reflected at other places.
Programmer Is it so! Thank you. I will follow it too.
OO Guru I have seen that you have mixed up potatoes and tomatoes. The rotten tomatoes spoilt potatoes. In OO programming also similar situation may arise. Then use the Encapsulate What Varies (EWV) principle. Don't let tomatoes spoil potatoes
Programmer It sounds sensible and your point is well taken.
I have been waiting for the car which I have booked, till now it has not come. I have to go out.
OO Guru I came to know that Car is at present not available. Only Van is available. That's why depend on Abstractions Not Concrete Classes (ANC). If you have ordered a 4 wheeled vehicle, then you might have got Van. Be generic not specific.
Programmer I understood the point. Now I order the 4 wheeled vehicle and I will take care in future.
OO Guru You are very receptive. By the way, your vehicle has arrived.
When you go out, talk to friends not strangers. This is another OO principle called Least Knowledge Principle (LKP).
Programmer Thank you for the advice. I will come back soon. By the time I come back, can you please get the analog clock replaced with digital clock in my room.
OO Guru OK. I will do.
Programmer Why is the wall of my room is being reconstructed?
OO Guru You have embedded the analog clock in the wall. Hence, to replace it with digital clock the wall is being reconstructed. If the analog clock was hung up, then it would have been easy to replace it with the digital clock. Foreseeing these complexities, OO veterans advise, favour Composition Over Inheritance (COI).
Programmer Now I understood it practically and it will become part of my vocabulary for programming.
Please give me your phone I want to call my boss.
OO Guru Hey, don't call your boss. Don't you know the Hollywood Principle (HOP), Don't Call us, we will call you.
Programmer OK OK. Then I will continue with my invention of wheel, to make the car.
OO Guru What did you say? Invention of wheel! Come on! Don't reinvent the wheel. Use the existing wheels and invent the car. In OO programming too, Apply Design Patterns (ADP), which are proven methods for the common programming tasks. What is in your hand?.
Programmer I am trying to bring 1 to 9 numbers in serial order on each face of this cube. It took so much time, but I could not succeed.
OO Guru In cube all the small cubes with numbers are very tightly coupled. Hence, you are facing the problem. Try for Loosely Coupled Systems (LCS). Don't get entangled. Take each plane with number 1 to 9.
Programmer You are awakening me with so many OO principles. How to remember and apply so many things.
OO Guru

Yeah! Good question. Remember our conversation and the acronym for each of the principles and while programming, observe, which OO principle is being violated. If you cannot apply the principle as it is, don't worry. These are principles not laws. Law is a stringent rule, which should be followed. Whereas, principles are guidelines, which can be followed as per the requirement.
While driving the vehicle we apply the relevant gear as per the speed variation automatically, apply the break immediately. In Transportation Engineering the theory behind applying brake is called, PIEV theory.
According to PIEV theory the time required to apply brakes is sum of the time required for perception, intellection, emotion and volition. Before an automobile is stopped, four specific areas of activity will happen:

  1. Perception: The hazard is perceived.
  2. Intellection: Whether hazard is legitimate is determined.
  3. Emotion: There is an emotional factor with respect to deciding if we want to stop.
  4. Volition: There is the physical volition of moving the foot from to the brake pedal.

But, while driving these steps happen automatically. Similarly, the 15 OO principles (5 SOLID and 10 IDEAL CHALK) may be studied thoroughly, so that they are applied naturally while doing the Object Oriented Programming.

Programmer This talk with you has instilled confidence in me.
OO Guru OK. Finally don't forget KISS.
Programmer KISS!
OO Guru It's an OO principle called, Keep It Simple and Stupid (KISS). Don't beat around the bush. Be straightforward.
Programmer Thanks a lot for the inspirational guidance.

I will be happy to see your comments and suggestions to improve the article

History

3 Mar 2012 - OOP word added in description. Spelling mistakes corrected. Table borders removed and text formatted

5 Mar 2012 - Sentence on comments and suggestions added

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ProEnggSoft
Engineer www.ProEnggSoft.com
India India
I am an Engineer with interest in programming.

Comments and Discussions

 
QuestionNice... PinmemberAlex Fr5-Mar-12 4:48 
AnswerRe: Nice... PinmemberProEnggSoft5-Mar-12 4:57 
GeneralRe: Nice... PinmemberAlex Fr5-Mar-12 6:03 
GeneralRe: Nice... PinmemberProEnggSoft5-Mar-12 6:17 
GeneralMy vote of 5 Pinmemberlogmeinhere28-Feb-12 22:15 
GeneralRe: My vote of 5 PinmemberProEnggSoft28-Feb-12 22:33 
GeneralMy vote of 4 PinmemberPetr Abdulin28-Feb-12 21:58 
GeneralRe: My vote of 4 PinmemberProEnggSoft28-Feb-12 22:35 
GeneralRe: My vote of 4 PinmemberPetr Abdulin28-Feb-12 23:02 
GeneralRe: My vote of 4 PinmemberProEnggSoft28-Feb-12 23:22 
GeneralMy vote of 5 PinmemberHoangitk28-Feb-12 16:50 
GeneralRe: My vote of 5 PinmemberProEnggSoft28-Feb-12 16:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141220.1 | Last Updated 5 Mar 2012
Article Copyright 2012 by ProEnggSoft
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid