Make Object Oriented?

M

Michael Yanowitz

Hello:

Are there any tools to convert non-object-oriented code
into object-oriented code?
If not, perhaps something that I can pass in two (or more)
classes and will create a base-class and simplify the passed
in classed to be derived from the base class?
Ideally this would be Python but if not, C-to-C++ would
be ok?

Thanks in advance:
Michael Yanowitz
 
S

Simon Hibbs

I can't even vaguely concieve of how such a think could work, even at a
trivial, hypothetical level. The code converter would ahve to actualy
understand at a general level what the program does and how it does it,
then come up with an orriginal way to solve the same problem using a
different methodology.

As to the simple case, even here, the converter would have to make
inteligent decisions. Which methods and properties should it move to
the base class, and which should it keep local? What criteria might it
use for making such a choice? How could you be sure that the decisions
it made would be useful or appropriate?


Simon Hibbs
 
B

Bruno Desthuilliers

Michael said:
Hello:

Are there any tools to convert non-object-oriented code
into object-oriented code?

Yes, of course. That's what we call a "programmer". Why ?
If not, perhaps something that I can pass in two (or more)
classes and will create a base-class and simplify the passed
in classed to be derived from the base class?
Ideally this would be Python but if not, C-to-C++ would
be ok?

Actually you need another language and processing device - AFAICT, a
well-trained human being would do.

A refactoring tool may help too (cf BicycleRepairMan ?) (NB : never
tried using such a tool myself), but I'd still mostly rely on gray
matter for this class (pun intented) of problems.
 
E

eduardo.padoan

It would be ease to create such a tool if you dont care if your code is
a Functional Decomposition
(http://c2.com/cgi/wiki?FunctionalDecomposition) AntiPatern. But OO
design is hard to do "automagically" from a bunch of functions and data
structures. Methods and attributes are in the same object for a
conceptual reason too, don't you think?
 
H

h112211

Michael said:
Hello:

Are there any tools to convert non-object-oriented code
into object-oriented code?

Nope, but you can have the next best thing: rewrite it from scratch
yourself.

I did that to a smallish (about 50k lines) C program once, and the
resulting 70k lines or so C++ program was superior to the old version
in many ways. However, maybe the best result was that after the rewrite
I knew the problem domain and the implementation inside out, much
better than I would've by reading and running the old C code, which was
written by someone else.

Of course, today I'd do it in 15k lines of Python ;)
 
J

John Salerno

Bruno said:
Hmmm ? May I express some very huge doubts here ?

But the link he gave also says this:

"Perfect Java programs can be written..."

Ok, I think some of this group's less-than-favorable opinion of Java has
rubbed off on me. :)
 
D

Donn Cave

"Simon Hibbs said:
I can't even vaguely concieve of how such a think could work, even at a
trivial, hypothetical level. The code converter would ahve to actualy
understand at a general level what the program does and how it does it,
then come up with an orriginal way to solve the same problem using a
different methodology.

As to the simple case, even here, the converter would have to make
inteligent decisions. Which methods and properties should it move to
the base class, and which should it keep local? What criteria might it
use for making such a choice? How could you be sure that the decisions
it made would be useful or appropriate?

Yes indeed. This must be OO fever in its most rarified form -
the notion that even mechanical conversion to OO would be an
improvement.

Donn Cave, (e-mail address removed)
 
B

Bruno Desthuilliers

John said:
But the link he gave also says this:

"Perfect Java programs can be written..."

Hmmm... May I express some very huge doubts here too ?-)
Ok, I think some of this group's less-than-favorable opinion of Java has
rubbed off on me. :)

What to say...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top