Oop: Encapsculation,implementation And Abstraction What Are They?

A Member? Please Login  
type your username and password to login
Date: October 14, 2008, 11:02 AM
249687 members and 148370 Topics
Latest Member: palmatins
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Oop: Encapsculation,implementation And Abstraction What Are They?
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Oop: Encapsculation,implementation And Abstraction What Are They?  (Read 340 views)
luckyCO
Oop: Encapsculation,implementation And Abstraction What Are They?
« on: January 22, 2007, 09:45 AM »

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.
parosky (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #1 on: January 22, 2007, 10:56 AM »

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.
luckyCO
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #2 on: January 22, 2007, 12:30 PM »

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.
sbucareer (f)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #3 on: January 22, 2007, 12:54 PM »


parosky, you are a pounded yam stew encapsulation, abstration and implementation genius. You couldn't have explained it better, well done.
kengimel (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #4 on: January 22, 2007, 04:56 PM »

Quote from: parosky on January 22, 2007, 10:56 AM
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.
luckyCO
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #5 on: January 24, 2007, 09:02 AM »

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?
kengimel (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #6 on: January 24, 2007, 09:46 AM »

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.

parosky (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #7 on: January 25, 2007, 03:19 PM »

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.
my2cents (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #8 on: January 26, 2007, 06:57 PM »

Haba!  No pounded yam analogy for delegates and serialization?  I had just started salivating Grin
luckyCO
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #9 on: January 28, 2007, 01:22 AM »

My2cent give us ur own analogy, don't abuse that fine example
my2cents (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #10 on: January 28, 2007, 09:21 PM »

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 this, kposa!! Na I'm my people 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 I'm 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
luckyCO
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #11 on: January 29, 2007, 08:34 AM »

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
luckyCO
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #12 on: January 30, 2007, 05:33 PM »

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.
boogieluv (m)
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #13 on: February 03, 2007, 07:28 PM »

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.
IG
Re: Oop: Encapsculation,implementation And Abstraction What Are They?
« #14 on: February 15, 2007, 08:51 PM »

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
Code:
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.
 I Need Help On Dhtml  Sql Tutorials  I Got Free Bonanza Testing For Microsoft Certified Applications Developer  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.