Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Lourdes Edwards   on Nov 23 In Java Category.

  
Question Answered By: Garrett Brooks   on Nov 23

I have a theory (which I am sure someone here will hate :P), but inside
every great C programmer is a OO programmer waiting to jump out.

Serriously, there are ways you can get the same effect. Except bending
your brain around them is much harder.


> (Actually I get the
> impression from C programmers that you can do anything in C but it
> will take longer)

That is pretty much the truth of the matter. Also if you are a not a
mystic c ninja then it will take even longer on top of that.

> b) Is it possible, to implement object oriented concepts in a
> procedural language?

Yes but they are strange, and mind bending. Essentialy one of the
reasons that OOP was invented was because they wanted to model the
entire universe (well attempt to), and they just couldn't do it with the
tools they had.


> I get your point that it is easier to create code  in OO languages,
> and easier to manipulate 'procedures' - classes. OK

It is probably easier to manipulate data in OO. However that is probably
all to do with how your brain was formed on programming. I am sure that
Scheme weenies love the way their kind of langage works


> My point about compilation is that in either case procedural or OO
> language created code, the compiled code is just a set of
> instructions fed to the processor but the OO language created code is
> longer and less efficient and maybe containing a lot of redundancy?

Actually OO code is designed to reduce redundancy. Also compiled code is
simply that compiled. Both C++ and C after compiled are essentialy the
same, both of them have been formed into machine code by the compiler.

As for what is longer and what isn't... that probably depends on how you
programm it. I have seen some pretty long winded waffly C code
recently, but I have also seen giant code circles in Java.

bad code is bad code, no matter what language you are writing it in.

At the end of the day OO code suffers a very slight performance hit
every time it loads up a object from scratch. There are ways to minimise
this difference, and with the speed of computers the whole speed issue
is rapidly becoming mute for all but a few industries.

C++ with inline Assembler is used in heaps of games instead of C and
inline assembler, in fact many games just use C++ instead of C now days.

OO code, at least in my mind, makes much more sense when there is a a
few hundred thousands of lines in the project. If you have to work on
the data object Person, you know exactly where it is. In fact it is
almost a metaphore for how the Class should be used.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Learning Java Or get search suggestion and latest updates.


Tagged: