Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#3.5

IDEAL CHALK Mnemonic Acronym and Mnemonic Images for Object Oriented Principles

4.93/5 (19 votes)
11 Nov 2018CPOL6 min read 57.4K   624  
IDEAL CHALK mnemonic acronym and mnemonic images for Object Oriented 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 for 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 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 acronyms for each of the principle 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 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 the 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.

License

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