Make Object Oriented?
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
Michael Yanowitz wrote: 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. -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
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? -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
Michael Yanowitz wrote: 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 ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
[EMAIL PROTECTED] wrote: It would be ease to create such a tool Hmmm ? May I express some very huge doubts here ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
Bruno Desthuilliers wrote: [EMAIL PROTECTED] wrote: It would be ease to create such a tool 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. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
In article [EMAIL PROTECTED], Simon Hibbs [EMAIL PROTECTED] wrote: 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, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Object Oriented?
John Salerno wrote: Bruno Desthuilliers wrote: [EMAIL PROTECTED] wrote: It would be ease to create such a tool Hmmm ? May I express some very huge doubts here ? 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... -- http://mail.python.org/mailman/listinfo/python-list