Explaining OOP programming the easy way

Old 1 Comment on Explaining OOP programming the easy way 65

Quote by Albert Einstein:  Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.”

I really do believe programming taught  in a Easily  to relate….would really give  programmers more creative approach:

I am gonna  explain simple GUI java program ..if even if you didn’t know anything about java it’s easy to relate

(idea of variables as boxes is taken from author : David J. Eck )

Tutorial of the game(CONSIDER IT LOL):

Before we  are gonna make some imaginative assumptions :

1 .Computer is a deaf guy who can understand logical operations such as >,<.==(means same as ),  mathematical operations , key words and {}

2.keywords is the only  set of words from the English language which the computer can understand , By using keywords ,like you communicate with a deaf guy showing specific actions you need to know these key words

{} are used to tell what instruction lie inside what

3. Mathematical operations involve variables say x , but we are going to assume them as boxes

4. boxes can store values , since it is a box ,you can specify who can access the box(public , private, protected), is it permanent storage or not  …it needs to be created before use


The magic of OOP or object oriented programming , you can create living things  , all living things are created and destroyed ;In case of Java Computer does the dirty work

Assume all living things are created after its own kind or type or class .All these types or classes can inherit from other classes

ie say chihuahuas ,Doberman both inherits its traits from dog although different looking

for creating living things , you must create the type  or class first, ie what is capable of doing , boxes are also used to house these animals , without a house , these animals will die.

Animals can do jobs using info from boxes may contain other animals too, and can return boxes too containing anything living or nonliving


5. You can create non living things too ..we will call them tools , A tool sometimes need boxes containing info , or info itself  from a certain type or class to work with

all tools like boxes too have access privileges  (public private protected )

tools before used anywhere and every where , it must be created

tools can be called from non living types or classes

The beauty of tools  , a tool can return boxes with values ,or  living things

6. While creating classes or tools  , we need to specify who can access it , the type of box it might work with(Only if you think its needed for it) ,and what type of box will it return ..or will it ?

7. there are specials set of tools that can be created under classes name, which is automatically executed when  animal of that class is created, or the computer automatically does it for you , and runs the animal

multiple tools of this type can be created, but only one is executed , these tools needs to be different by the boxes they use

Now we have covered  Introduction

Game Play Example :Simple Paint Program 

IN java we special set of tools that does not need to be implemented , to execute ..these tools use a special box of type MouseEvent .


Related Articles

1 Comment

Leave a comment

Back to Top