PDA

View Full Version : script editor that creates OO constructs?


chump2877
04-06-2006, 01:40 PM
hey kids,

I was reading through one of the posts on here debating procedural vs. OO coding, and that sparked a few ideas of my own -- ideas that might help procedural programmers transition into OO programming a little more easily.

First of all, before I touch upon the OO concept, i think a script editor that allowed you to take procedural code and turn it into a function would be ideal for lots of people....you select a block of code, then click on a "function" button somewhere, and the editor takes the code, plops it into a function, adjusts variable scope, and creates the function call in your code...maybe the editor even adds a "return" line at the end of the function...

Now I know this isn;t a new idea, because i've heard of editors that do exactly this....General question for you guys: What are some of the best scripting editors out there that perform this kind of "function-creation" service for coders?

Next, what if you took this idea one step further, and had a script editor that not only created functions for you, but also enabled you to take all of your functions and procedural code and turn them into PHP classes. Are there editors out there that can do this? Effectively?

I think an editor like this would encourage OO programming habits. And it would enable OO beginners to see the differences between procedural and OO coding, and see how both styles of coding can accomplish the same thing in different ways. It's one thing to try to read about how to program with OO concepts (which can be confusing), and its another thing to use OO concepts practically (which can be even more confusing). An editor such as this would help bridge the gap between understanding OO concepts and actual OO application and implementation in your code.

Well, I have to think that this isn't a new idea (most ideas aren;t ;) ), but a script editor like this could really help a lot of people on here make the switch from procedural coding to OO habits....So, again, are there any editors out there that are powerful enough to accomplish this effectively?

And I'm certainly not supporting laziness in coding, I'm simply looking for a way to increase comprehension of OO methods through practical application -- pretty much by studying HOW the editor turns your procedural code into OO code....

fci
04-06-2006, 02:10 PM
turning a bunch of functions into a class would merely be a wrapper which means you would be likely calling static methods instead of instance methods to perform the same function as before (although, in theory, if a common parameter was identified, it could be set as a property but the programmer would need to have consistent variable names for that to happen, mmm, probably not that hard to create a loose 'translator'...).. which negates building any understanding of OO.

Brandoe85
04-06-2006, 02:34 PM
Wouldn't an editor like this create lazyness? :o
I don't think an editor could really encourage OOP on the programmer.
Coding OOP is just syntax, the imporant thing is you understand the concept of OOP, in which I don't think an editor can teach.