The Artima Developer Community
Sponsored Link

Design Forum
Practically OOPs

2 replies on 1 page. Most recent reply: Jun 3, 2004 2:38 AM by Shashank D. Jha

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
nev

Posts: 1
Nickname: cybernevl
Registered: May, 2004

Practically OOPs Posted: May 16, 2004 10:42 PM
Reply to this message Reply
Advertisement
Hi,

I have been a procedural prgrammer for the better part of my career. As such I do know OOPs conceptually, but still unable to apply it meaningfully when coding. I mean whats the deal with overriding or overloading. Why not write a function with a different name?
So could some one guide me to some good reading on practical application development using oops or some source code of a fully developed application in vb.net or C# where oop is used. Through all this I'd basically like to know in what development situations does OOP score over Procedural programming.

Thanks


Wim Ahlers

Posts: 3
Nickname: wahlers
Registered: Apr, 2004

Re: Practically OOPs Posted: Jun 1, 2004 1:52 AM
Reply to this message Reply
For an excellent book concerning 'why OOA/OOD/OOP' see link:
http://www.amazon.com/exec/obidos/tg/detail/-/020169946X/qid=1086075543/sr=1-1/ref=sr_1_1/002-3749966-3388865?v=glance&s=books

Fundamentals of Object-Oriented Design in UML
by Meilir Page-Jones (Author)

OOP only 'works' when properly used...and that is the tricky part.
Some 'things' are inherently procedural based, such as many mathematical algorithms (in JAVA this may be implemented as static methods). Other 'things' are inherently class based, such as customer, part, invoice, etc... Object-oriented programming (this should actually be called class-oriented programming but nobody does) is an extension (and an important extension) to procedural-oriented programing.
Having said this, it is(!) important to change your procedural mindset to a more object-oriented mindset. This does not mean that all your previous knowledge (like structured programming) are suddenly bypassed! You just use it in a different, more object-oriented, way.

Those who work in a procedural environment, or those who are in the transitional phase from procedural to object-orientation (or are otherwise procedural oriented, like you) may find the following PDF document useful, see link:
http://www.programmersheaven.com/2/Art_ObjBasedSystems

I have no example programs myself but you can scan the internet. I found this for you (in JAVA), see link:
http://www.redcatsoftware.com/ajcarracer.htm

(Tip: read my comments about JAVA first, see PDF document)

Regards, Wim Ahlers
(The Netherlands).

Shashank D. Jha

Posts: 68
Nickname: shashankd
Registered: May, 2004

Re: Practically OOPs Posted: Jun 3, 2004 2:38 AM
Reply to this message Reply
Well, its nothing of your fault.

I too feel overloading and overriding are not OOAD concepts as such.

They come to handy in following situation:

1. Suppose you have defined a method in your base class "Authorize" called "login". You have implemented it there wherein you check for name in a data base and validate if the name has registered (for simplicity).

Now you have a derived class called "AuthorizeAccess". Now here client calls login method, you want to do validation in some other way may be looking into a file system. So you will re-implement the same function in derived class as well. This becomes overriding a funtion.


Similarly suppose

For login a buyer needs to pass its name information, but a seller needs to pass information about name and id. In that case you wont want to have a function name depending on who wants to log-in (just to keep code clean). So you will still keep the function name same as login (after all both wants to just-login). but two signatures will be defined

login (String name); and login (String name, long id);

it just ensures clean code. You may have another funtion name but logically both functions have same meaning.

So this becomes your operation overloading.

regards,
Shashank

Flat View: This topic has 2 replies on 1 page
Topic: Need Help To Build  Web Flash and HTML Templates ??? Previous Topic   Next Topic Topic: UML Notation Question

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use