Make Object Oriented?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Yanowitz

    #1

    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


  • Simon Hibbs

    #2
    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

    Comment

    • Bruno Desthuilliers

      #3
      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 BicycleRepairMa n ?) (NB : never
      tried using such a tool myself), but I'd still mostly rely on gray
      matter for this class (pun intented) of problems.


      Comment

      • eduardo.padoan@gmail.com

        #4
        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 "automagica lly" 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?

        Comment

        • h112211@gmail.com

          #5
          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 ;)

          Comment

          • Bruno Desthuilliers

            #6
            Re: Make Object Oriented?

            eduardo.padoan@ gmail.com wrote:
            It would be ease to create such a tool
            Hmmm ? May I express some very huge doubts here ?

            Comment

            • John Salerno

              #7
              Re: Make Object Oriented?

              Bruno Desthuilliers wrote:
              eduardo.padoan@ gmail.com 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. :)

              Comment

              • Donn Cave

                #8
                Re: Make Object Oriented?

                In article <1155211932.632 684.185920@m73g 2000cwd.googleg roups.com>,
                "Simon Hibbs" <simon.hibbs@gm ail.comwrote:
                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, donn@u.washingt on.edu

                Comment

                • Bruno Desthuilliers

                  #9
                  Re: Make Object Oriented?

                  John Salerno wrote:
                  Bruno Desthuilliers wrote:
                  >eduardo.padoan@ gmail.com 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...

                  Comment

                  Working...