473,724 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object Oriented Programming (OOP)

Pmb
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to
learn Object Oriented Programming (OOP). In discussing this with people I
came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops
a software library of classes and this cuts down the overhead of reinventing
the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?
2) Can OOP be accomplished with non-object oriented languages such as C?
3) If you're not part of a software engineering team but are programming
from your own use and don't need to reuse code would you bother with OOP?

Thanks

Pmb
Jul 22 '05 #1
34 3197

"Pmb" <so*****@somewh ere.com> wrote in message
news:b4******** ************@co mcast.com...
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to
learn Object Oriented Programming (OOP). In discussing this with people I
came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops a software library of classes and this cuts down the overhead of reinventing the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?
It forces a better design in my opinion, and offers data hiding. Another
advantage is the reduced amount of parameters transferred to and from
functions, since many methods access member variables within a class
2) Can OOP be accomplished with non-object oriented languages such as C?
It can be emulated, but from what I have seen is very messy, and isnt
readable.
3) If you're not part of a software engineering team but are programming
from your own use and don't need to reuse code would you bother with OOP?


I program for pleasure and use it for many reasons, here is an example:

I have a game which I am programming. The entities in my game follow a
simple heirarchy:

class GameEntity // specifies interface for Step() and Draw(). Has one
member variable "bool Valid"

class Ship : public GameEntity // define a ship which has Shoot(), Die()
etc.

class PlayerShip : publilc Ship // defines the player ship which has input
controls etc.

I follow a similar heirarchy for scenery, for powerups etc. It makes things
a lot neater, and if you incorporate the methods as high up the hierarchy as
possible, the less duplicate code there is.

Allan
Jul 22 '05 #2
Hi, this will be my first post to this group as well...

I've only just started using OOP myself. It's kind of interesting the sort
of mind set you get into. Although I still believe that alot of OOP
implementation is done just plain badly it does make it easier to relate
your code to real 'objects'.

Personally I think both have their place but OOP allows you encapsulate
things a hell of alot better than just straight stuctured.

C doesn't allow for the encapsulation that OOP pushes and so is unsuitable
for OOP - but if you aren't one for the rules and want to make things a
hell of alot harder on yourself, seeing as OOP seems to be a mentality
more than anything, C and possibly even pascal should be able to do it to
some strange and wierd extent.

If programming for your own use, I still think OOP is worthwhile. If at
some later date you wish you go over the code again, it's alot easier
looking at the individual objects and knowing exactly what they relate to
rather than trying to figure out each of the functions. This could of
course be fixed with comments but why bother if you can just code it in?

From working with a friend on the occassional little project, I've found
that we can each work on an object each, pull them together and get it all
working together with very little work involved.

Hope this at least answers some of your questions...

regards, Nevyn.

On Fri, 21 May 2004 07:53:08 -0400, Pmb wrote:
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to
learn Object Oriented Programming (OOP). In discussing this with people I
came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops
a software library of classes and this cuts down the overhead of reinventing
the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?
2) Can OOP be accomplished with non-object oriented languages such as C?
3) If you're not part of a software engineering team but are programming
from your own use and don't need to reuse code would you bother with OOP?

Thanks

Pmb


Jul 22 '05 #3
Pmb

<ne***@localhos t.localdomain> wrote in message
news:pa******** *************** *****@localhost .localdomain...
Hi, this will be my first post to this group as well...

I've only just started using OOP myself. It's kind of interesting the sort
of mind set you get into. Although I still believe that alot of OOP
implementation is done just plain badly it does make it easier to relate
your code to real 'objects'.

Personally I think both have their place but OOP allows you encapsulate
things a hell of alot better than just straight stuctured.

C doesn't allow for the encapsulation that OOP pushes and so is unsuitable
for OOP - but if you aren't one for the rules and want to make things a
hell of alot harder on yourself, seeing as OOP seems to be a mentality
more than anything, C and possibly even pascal should be able to do it to
some strange and wierd extent.

If programming for your own use, I still think OOP is worthwhile. If at
some later date you wish you go over the code again, it's alot easier
looking at the individual objects and knowing exactly what they relate to
rather than trying to figure out each of the functions. This could of
course be fixed with comments but why bother if you can just code it in?

From working with a friend on the occassional little project, I've found
that we can each work on an object each, pull them together and get it all
working together with very little work involved.

Hope this at least answers some of your questions...


Yes. Thanks.

Would you use OOP if you were writing a program to do some number crunching,
e.g. solving a differential equation etc.?

Pmb
Jul 22 '05 #4
Pmb

"Allan Bruce" <al*****@TAKEAW AYf2s.com> wrote in message
news:c8******** **@news.freedom 2surf.net...

"Pmb" <so*****@somewh ere.com> wrote in message
news:b4******** ************@co mcast.com...
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to learn Object Oriented Programming (OOP). In discussing this with people I came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops
a software library of classes and this cuts down the overhead of

reinventing
the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?


It forces a better design in my opinion, and offers data hiding. Another
advantage is the reduced amount of parameters transferred to and from
functions, since many methods access member variables within a class
2) Can OOP be accomplished with non-object oriented languages such as C?


It can be emulated, but from what I have seen is very messy, and isnt
readable.
3) If you're not part of a software engineering team but are programming
from your own use and don't need to reuse code would you bother with OOP?


I program for pleasure and use it for many reasons, here is an example:

I have a game which I am programming. The entities in my game follow a
simple heirarchy:

class GameEntity // specifies interface for Step() and Draw(). Has one
member variable "bool Valid"

class Ship : public GameEntity // define a ship which has Shoot(), Die()
etc.

class PlayerShip : publilc Ship // defines the player ship which has input
controls etc.

I follow a similar heirarchy for scenery, for powerups etc. It makes

things a lot neater, and if you incorporate the methods as high up the hierarchy as possible, the less duplicate code there is.


Thanks.

As I asked Nevyn, would you use OOP if you were writing a program to do some
number crunching, e.g. solving a differential equation etc.?

Pmb
Jul 22 '05 #5
> Thanks.

As I asked Nevyn, would you use OOP if you were writing a program to do some number crunching, e.g. solving a differential equation etc.?

Pmb


It entirely depends!

I would use OOP if it were part of a bigger project, no two ways about it.
For example, one class may be a solver for differenial equations. One could
have linear ODEs and others done within this class.

If you mean, would I program an OOP just to solve one equation, then the
answer is no. I would do it in Matlab!

Basically, what I am trying to say is, if I am programming something of
medium scale or larger, then I would do it using OOP, if it is small scale,
i.e. a few lines of code, then I wouldn't program it in a low-level
language, I would use other tools, e.g. Matalab.

Allan
Jul 22 '05 #6
"Pmb" <so*****@somewh ere.com> wrote in
news:V8******** ************@co mcast.com:

(...)
Would you use OOP if you were writing a program to do some number
crunching, e.g. solving a differential equation etc.?


Why not? http://www.oonumerics.org/

"Object oriented" describes a programming paradigm. As all other paradigms,
you can see it in different perspectives, depending on your own point of
view.

C++ being a multi-paradigm language, allows you to freely mix OO concepts
with plain imperative 'C' programming style, and even functional style.
On one hand, it's much more versatile and powerful. On the other, it gives
*a lot* of opportunities for misuse. This is all obvious, though. :)

--
:: bartekd [at] o2 [dot] pl

Jul 22 '05 #7
Hi Pmb,

I like component programming in C++. I also like programming OOP. Simply because
it allows you to comprehend the problems/ solution in terms of objects rather
then functions. It just allows you to structure your program better then what is
possible using even C but in a easier way.

Encapsulation, polymorphism, inheritance are features are OOAD and can be
achieved using C as well, but yeah simple to achieve or design in C++.

Similarly re-use or not you may do in C as well as C++. Its just because you can
comprehend the problem and solution easier in OO methodology that enhances
chances of writing code that may be re-used.

So you will find, moving from C to C++ (or object oriented) is primarily because
it allows to create well structured software easily (because of some features as
mentioned above, that are by default part of objects then in structure where
you will have to code for it!!) compared to structure language.

regards,
Shashank

Pmb wrote:
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to
learn Object Oriented Programming (OOP). In discussing this with people I
came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops
a software library of classes and this cuts down the overhead of reinventing
the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?
2) Can OOP be accomplished with non-object oriented languages such as C?
3) If you're not part of a software engineering team but are programming
from your own use and don't need to reuse code would you bother with OOP?

Thanks

Pmb


Jul 22 '05 #8
Hi Pmb, a.k.a. Pete,

In an e-mail, you asked me why I think OOP is modal.

Google, " define:modal ":
http://www.google.com/search?q=defin...al&btnG=Search
" Pertaining to modes. "
...
" A dialog is modal if its parent application
is blocked from further activity
^^^^^^^
until the dialog has completed. See non-modal. "

OOP is a hierarchy,
and, like all hierarchies, it's usually overdone.

The flatter one can keep one's data
the more accessible it becomes.

For example, take a perfectly flat map of the world,
a user simply pans and zooms to see what he wants.
No need to go browsing through
some absurd tree of rigid directories,
branching here and there, going ever deeper,
getting ever more lost.

That's the problem with OOP, it's too convoluted.

I hate pop-ups for the same reason,
as each dialog window pops up, you enter another mode,
it's annoying. Flat is where it's at.

In my programs I make a real effort to
eliminate All pop-ups.
I also don't like sub-sub-sub-sub menus.

So I replace them with a maximized window
( where my Win98 taskbar is the only other window ).

Then I navigate using different combinations and durations
of buttons on my 5 button wheel mouse ...
So that everything is accessible all the time,
no need to consider what mode I might be in.

The terrain ( i.e. the data ) is keep flat like a map ...
I just pan and zoom.
Jul 22 '05 #9
"Pmb" <so*****@somewh ere.com> wrote
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to
learn Object Oriented Programming (OOP). In discussing this with people I
came up short as to what the benefits of OOP are. For example: As I
understand it, OOP has its main benefit in software reuse. Thus one develops
a software library of classes and this cuts down the overhead of reinventing
the wheel. Someone might say that this can be done with structured
programming with function libraries. So I have a few questions.

1) For those of you who like OOP, why do you like it?
Managing complexity is a cornerstone of programming and OOP is one tool that
helps do that. C++ offers other paradigms, including structured and generic
programming, that also help in managing complexity.
2) Can OOP be accomplished with non-object oriented languages
such as C?
Yes it can. It's just less automated. In the same vein, you can do functional,
declarative, and symbolic programming with C++. The language just doesn't give
you shortcuts to do so.
3) If you're not part of a software engineering team but are
programming from your own use and don't need to reuse
code would you bother with OOP?


If you're not a professional carpenter, but you have to put in a screw, will you
use a hammer just because it's only for your personal use? Of course not. You use
the tool that's most appropriate to what you're doing. You use OOP if the
solution can be best expressed in an OO manner. If it can best be expressed
otherwise, you don't use OOP.

Claudio Puviani
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3471
by: ggg | last post by:
I'm looking for a complete project/application done with heavy use of of object-oriented programming & design. Preferably something well documented and/or commented so that I can pick it apart and learn how/why they designed it they way they did. Any suggestions?
65
4271
by: Roger Smythe | last post by:
A means for the progressive decomposition a problem space into increasingly simpler component parts such that these component parts represent higher levels of conceptual abstraction, and are completely independent of each other except for their well-defined interfaces. This was an attempt to explain the gist of OOP to programmers accustomed to the structured programming paradigm. I tried to explain OOP in terms of ideals that can be...
100
5257
by: E. Robert Tisdale | last post by:
What is an object? Where did this term come from? Does it have any relation to the objects in "object oriented programming"?
8
2386
by: Dale | last post by:
I've searched Amazon and read probably 100 reviews but can't find what seems to be any book that is widely accepted as the definitive book on object oriented programming design and techniques. And most of the highest rated are all written 10 to 15 years ago. Any good suggestions?
4
1786
by: scottrm | last post by:
I am fairly new to oo design and I am looking at developing an object oriented asp.net application which will be built on top of a relational database. I have read quite a bit of the theory but find it hard to put it into practice. In particular I am confused in terms of interacting with the database. It seems to me classes map quite closely to database tables and I end up with a bunch of methods in each class which simply call stored...
15
2468
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for objects that the app used to speed up some global level data access and functionality. I have recoded the class libraries in .net and would like to acomplish the same functionality in asp.net.
2
1714
by: Chris Asaipillai | last post by:
Hi there Im starting a new course this Saturday. OBJECT ORIENTED DEVELOPMENT WITH VISUAL BASIC .NET and will cover the following concepts and principles. a.. Be able to build VB.NET applications using custom object design. b.. Utilise existing .NET Framework objects and extending functionality. c.. Become familiar with how to utilise the IDE to help OOP.
73
4483
by: Water Cooler v2 | last post by:
I am new to PHP, just one day new. But I am otherwise a seasoned programmer on many other languages like C, VB 6, C#, VB.NET, Win32 platform and have some tiny bit experience in MFC, C++, Python. All the tutorials I read so far about PHP contain procedural examples. I haven't yet come accross a tutorial on the object oriented PHP. Could someone point me to one?
139
5959
by: Joe Mayo | last post by:
I think I become more and more alone... Everybody tells me that C++ is better, because once a project becomes very large, I should be happy that it has been written in C++ and not C. I'm the only guy thinking that C is a great programming language and that there is no need to program things object oriented. Many people says also that they save more time by programming projects object oriented, but I think its faster to program them in a...
0
8868
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9160
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8062
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5996
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.