|
luckyCO
|
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)
|
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
|
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)
|
parosky, you are a pounded yam stew encapsulation, abstration and implementation genius. You couldn't have explained it better, well done.
|
|
|
|
|
|
kengimel (m)
|
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
|
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)
|
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)
|
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  ). 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)
|
Haba! No pounded yam analogy for delegates and serialization? I had just started salivating 
|
|
|
|
|
|
luckyCO
|
My2cent give us ur own analogy, don't abuse that fine example
|
|
|
|
|
|
my2cents (m)
|
Okay make i try. Abi, how I go do?  Delegation: E don tay wey I chop better soup  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?  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  ), but the point is, at another place and time, the food will be recreated, either digested or as (sorry) excrement. Does this pass muster? 
|
|
|
|
|
|
luckyCO
|
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
|
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)
|
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
|
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.
|
|
|
|
|
|