Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,786 members, 7,817,257 topics. Date: Saturday, 04 May 2024 at 08:55 AM

Oop: Encapsculation,implementation And Abstraction What Are They? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Oop: Encapsculation,implementation And Abstraction What Are They? (2629 Views)

Why Is OOP PHP So Confusing? / Understanding Programming-(lesson 1- Abstraction Of Objects) / Oop's Abstraction Flaw-[minor But Still A Flaw] (2) (3) (4)

(1) (Reply) (Go Down)

Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 9:45am On Jan 22, 2007
Plz I need explanation of this three terms of OOP: Encapsculation,Implementation and Abstraction. I have being reading it but find it difficult to understand. Plz if u can with simples example depicting what will happen for me to say that any three of then has taken place.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by parosky(m): 10:56am On Jan 22, 2007
Imagine you work in a canteen in the stew making unit, you have your recipe(CLASS) for making stew. Your colleague who is in pounded yam making unit also have recipe for pounded yam. Same goes for every other unit. Once all the units have done their jobs very well, all the waiters need to do is get their trays, go to pounded yam unit , get 2 wraps (OBJECT) of pouded yam for a customer, go to stew making unit for a bowl of soup, meat making unit for 3 pieces of meat. The waiters don't need to know the various steps taken in pounded yam unit to get things done. That is, the complexities of how they (pounded yam unit) get things done is hidden from you guys in stew, soup, amala, eba making unit. This is ABSTRACTION.

In pounded yam unit , they get raw yam, peel it cook it, pound it,and so on but it is not your concern. They add water if they think it is not soft enough for good eating but you don't need to know that. By the time the finish their job, you won't have the opportunity to peel yam, cook it, pound it (controlled by FIELDS, PRIVATE, MEMBER VARIABLES). But you can open the wrap, take a bolus, mold it, check the softness, put it in stew, swallow it. In short you are able to interact with pounded yam (through it's PUBLIC MEMBERS - PROPERTIES and METHODS that was exposed , in this case the pounded yam itself) without knowing how  it's prepared (or it's IMPLEMENTATION) but not with it's fundamental preparation process because it has been ENCPSULATED. 

Does Abstraction and encapsulated look like the same to you? Well they really are not but close enough.

1 Like

Re: Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 12:30pm On Jan 22, 2007
Thanks a lot man. So it is what am being doing all the while while building my class in .Net. It is good to ask questions. Somebody called for .Net lectures that is why I need to know their explanation. Thanks a million.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by sbucareer(f): 12:54pm On Jan 22, 2007

parosky, you are a pounded yam stew encapsulation, abstration and implementation genius. You couldn't have explained it better, well done.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by kengimel(m): 4:56pm On Jan 22, 2007
parosky:

Imagine you work in a canteen in the stew making unit, you have your recipe(CLASS) for making stew. Your colleague who is in pounded yam making unit also have recipe for pounded yam. Same goes for every other unit. Once all the units have done their jobs very well, all the waiters need to do is get their trays, go to pounded yam unit , get 2 wraps (OBJECT) of pouded yam for a customer, go to stew making unit for a bowl of soup, meat making unit for 3 pieces of meat. The waiters don't need to know the various steps taken in pounded yam unit to get things done. That is, the complexities of how they (pounded yam unit) get things done is hidden from you guys in stew, soup, amala, eba making unit. This is ABSTRACTION.

In pounded yam unit , they get raw yam, peel it cook it, pound it,and so on but it is not your concern. They add water if they think it is not soft enough for good eating but you don't need to know that. By the time the finish their job, you won't have the opportunity to peel yam, cook it, pound it (controlled by FIELDS, PRIVATE, MEMBER VARIABLES). But you can open the wrap, take a bolus, mold it, check the softness, put it in stew, swallow it. In short you are able to interact with pounded yam (through it's PUBLIC MEMBERS - PROPERTIES and METHODS that was exposed , in this case the pounded yam itself) without knowing how  it's prepared (or it's IMPLEMENTATION) but not with it's fundamental preparation process because it has been ENCPSULATED. 

Does Abstraction and encapsulated look like the same to you? Well they really are not but close enough.

Men parosky u have illustrated Abstraction and Encapsulation in a very good way.

i am very amazed by such extent of reasoning.

thumbs up.
keep it up.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 9:02am On Jan 24, 2007
parosky or any other person who knows it
Plz can you help explain delegates and serialization. What are they for and what can I do with them?
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by kengimel(m): 9:46am On Jan 24, 2007
Serialization means to force one-at-a-time access for the purposes of concurrency control, or to encode a data structure

as a sequence of bytes. In the Java world, serialization is the storing of an object's current state on any permanent

storage media for later reuse. This is done using when you use the seriazlizable interface or when using the

ObjectOutputStream and ObjectInputStream classes.


In object-oriented programming there are two related notions of delegation.

Most commonly, it refers to a programming language feature making use of the method lookup rules for dispatching so-

called self-calls as defined by Lieberman in his 1986 paper "Using Prototypical Objects to Implement Shared Behavior in

Object-Oriented Systems".

In its original usage, delegation refers to one object relying upon another to provide a specified set of functionalities. In

research, this is often referred to as consultation or as aggregation in modeling.

Interestingly, despite delegation being fairly widespread, no major programming languages implement delegation as an

alternative model to static inheritance. The Self programming language incorporates the notion of delegation through its

notion of mutable parent slots which are used upon method lookup on self calls.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by parosky(m): 3:19pm On Jan 25, 2007
When your methods take a parameter whose type you don't know before hand, then it's time to use delegate. Just like  it's counterpart in English language (not a programming language  grin). You give the responsibility of getting a job done to some other routine, the DELEGATE. This will work as long as the calling routine has the same signature as the delegate. A good example is a situation where you need to compare or sort objects. You make you code reusable by using delegate. The same routine can be used for comparing or sorting numeric, string, age, cow, goat, person or any type of object.

Serialization is the process of converting an object to a stream of bytes that can be written
to another data source, like a file.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by my2cents(m): 6:57pm On Jan 26, 2007
Haba! No pounded yam analogy for delegates and serialization? I had just started salivating grin
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 1:22am On Jan 28, 2007
My2cent give us ur own analogy, don't abuse that fine example
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by my2cents(m): 9:21pm On Jan 28, 2007
Okay make i try. Abi, how I go do? wink

Delegation:
E don tay wey I chop better soup grin and so as I just land naija like dis, kposa!! Na im my pple offer me 2 soups - Edikang Ikong complete with periwinkle, stock fish and kpomo; and Egusi complete with the most finger-licking Eja known to man. So I ask myself, wetin I go do? Should I delegate the choppings such that it is one soup to my left hand and to my right hand, or just to my right hand? More importantly, which of the 2 scenarios would be considered true delegation? wink

Serialization:
As I don delegate the situation finish, I say, oya make I chop the soup. As I dip the eba into the soup, na im the eba pick up meat, periwinkle and stockfish at the same time. Once I put the eba for my mouth, I am faced with a "serializable" dillema: Should I swallow it whole or should I separate the contents, eat them separately and swallow accordingly? In the end, all na food and all go enter my belle (i.e they are encoded in a structured way grin), but the point is, at another place and time, the food will be recreated, either digested or as (sorry) excrement.

Does this pass muster? tongue
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 8:34am On Jan 29, 2007
My2cents
You no serious! Why not go to Jokes forum and post this, I think people will laugh for you. Wel your posting makes sense but harness it more for simple man to understand just like parosky
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by luckyCO(m): 5:33pm On Jan 30, 2007
Looking at CommandButton it likes like buton,Textbox the same. In Vb.net how can I build my own custom control and make it have any Icon or picture I want it to have?
I know how to write custome controls atleast can do something. But after building mine it will display in toolbox as if it is system file.
Plz I need help.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by boogieluv(m): 7:28pm On Feb 03, 2007
Now i like wats going on here. All the analysis and explanation have been d best. Y havent we craeted our own Software yet to the global market.
Re: Oop: Encapsculation,implementation And Abstraction What Are They? by IG: 8:51pm On Feb 15, 2007
first of all @parosky, you sound like a great programmer/teacher. I'm highly impressed by the pounded yam analogy.

@luckyCO, here's what I think is an easier way of understanding delegates.
Normally one can declare variable of certain types which means you can put any data of that type in that variable.
e.g
Dim I as integer
means you can put any integer value in I.

Delegate are like variable but instead of holding normal values, they hold methods(subroutines or functions in VB)
You can assign any method that has the same signature as the delegate to the delegate.
You can then call the method by calling the "invoke" function of the delegate.

To put it short, delegates are variables that hold subroutine and functions.

In C++ they are called function pointers.

(1) (Reply)

List Web Services And Apis Here / Native Mobile Internet App Or Responsive Site? / Subject Deleted!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 40
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.