473,326 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

A question about understanding

Hello!

A friend of mine asked me the following question that is quite difficult to
answer. He use only C and can't find any problem with it.
Which problem is there when not using an OOP in solving problem compare to
when you using one OOP.

//Tony
Jul 23 '05 #1
7 1339
"Tony Johansson" <jo*****************@telia.com> wrote in message news:TV*******************@newsb.telia.net...
Hello!

A friend of mine asked me the following question that is quite difficult to
answer.
For whom? ;-)
He use only C and can't find any problem with it.
Which problem is there when not using an OOP in solving problem compare to
when you using one OOP.


Well, C and C++ are both general programming languages - anything you can do in one you can do in the other.

There are arguably some programming tasks which seem particularly suited to the OO paradigm; event-driven programming
(as in GUI's or games, for example) comes to mind. There are, equally, programming tasks for which OOP is likely to be
pretty pointless - sequential number-crunching scientific applications, for instance.

Also, be aware that C++ doesn't *enforce* OOP; it facilitates it. Likewise, C doesn't preclude OOP, but nor does it
particularly encourage it.

To give an example, I write mostly (non-GUI) scientific apps. I use C++, although most of the time I find myself using
very few of the OO features of the language (I can hardly remember when I last coded a virtual function). I could just
as well use C - the main reason I don't is because of other appealing aspects of C++ such as neater I/O, generic
programming (templates) and containers.

You choose your programming language/programming paradigm according to the task.

HTH,

--
Lionel B

Jul 23 '05 #2
Tony Johansson wrote:
Hello!

A friend of mine asked me the following question that is quite difficult to
answer. He use only C and can't find any problem with it.
Which problem is there when not using an OOP in solving problem compare to
when you using one OOP.

There is no silver-bullet solution. In most cases OO paradigm provides easier organisation
of data/concepts.

You may find the following useful:

http://www.itworld.com/AppDev/710/lw...up/page_1.html

http://www23.brinkster.com/noicys/do...eaking-cpp.pdf

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #3
Lionel B wrote:
"Tony Johansson" <jo*****************@telia.com> wrote in message news:TV*******************@newsb.telia.net...
He use only C and can't find any problem with it.
Which problem is there when not using an OOP in solving problem compare to
when you using one OOP.


I believe there are instances where C is preferable to C++.
To give an example, I write mostly (non-GUI) scientific apps. I use C++, although most of the time I find myself using
very few of the OO features of the language (I can hardly remember when I last coded a virtual function). I could just
as well use C - the main reason I don't is because of other appealing aspects of C++ such as neater I/O, generic
programming (templates) and containers.


I use C++ for scientific apps only. However, I use OO quite a bit!
Often, I find myself wishing that my counterparts gave OO a little more
consideration; especially when writing code that will be used by others
or become a part of an operational or quasi-operational system.

That's my rant for the day.

- dan
Jul 23 '05 #4
I agree with the authors of the two earlier posts, that you have to
choose the Paradigm/Language according to your task you have to solve.

But an important point of OOP is the use of Encasulation.
This means that you don't grant access to other pieces of Software if
you don't want it. The object is some sort of Blackbox. It (hopefully)
does what you want it to do, but how it does its job is not relevant to
the one using it. So it is possible to change the structure behind the
object without having to change the code depending on the object.

You may have a look at this book:
http://www.iam.unibe.ch/~ducasse/Fre...alk-and-OO.pdf

It describes the advantages of OOP to procedural programming.
It is based on and introduces Smalltalk a 'real' object oriented
programming language.

Manfred
Jul 23 '05 #5
Manfred wrote:
I agree with the authors of the two earlier posts, that you have to
choose the Paradigm/Language according to your task you have to solve.
In general I agree with your praise of encapsulation. But encapsulation
is not an OO feature but used in any reliably programming paradigm or
style. Also (especially!) in procedural C programming.
But an important point of OOP is the use of Encasulation.
This means that you don't grant access to other pieces of Software if
you don't want it. The object is some sort of Blackbox. It (hopefully)
does what you want it to do, but how it does its job is not relevant to
the one using it. So it is possible to change the structure behind the
object without having to change the code depending on the object.


IMO, encapsulation is more important than polymorphism. The latter is a
real OO feature.

R.C.

Jul 23 '05 #6
In other words, there is not one only way that is suitable for everything.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #7
Tony Johansson wrote:

Hello!

A friend of mine asked me the following question that is quite difficult to
answer. He use only C and can't find any problem with it.
Which problem is there when not using an OOP in solving problem compare to
when you using one OOP.


Before you try top answer that question you should try to answer
another question first.

What problem can be solved in a high level language that cannot be
solved by programming in assembler?

Or another one:

What problem can be solved in assembler that cannot be solved by programming
the CPU with hex opcodes?

The thing is: OOP, High level languages, assembler, ... are not concepts
that solve real world problems. They are concepts that help the programmer
to get more productive by organizing the source code and taking away the
error prone, boring, repeating steps when creating a program.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #8

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
30
by: questions? | last post by:
say I have a structure which have an array inside. e.g. struct random_struct{ char name; int month; } if the array is not intialized by me, in a sense after I allocated a
8
by: readytoride39 | last post by:
I am curious where does C# fit in regarding C and C++? Is it an extension of standard C with just a fancy name to take into account ..NET or is more than that? I am a C programmer so I am curious...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.