views:

122

answers:

3

Back in the scripted ASP and ColdFusion days, I used to work on projects that would build code generators for ASP or Coldfusion, typically in C++, in order to be more object oriented in application design and not have developers writing scripted code, which often was called "spaghetti code" for it's size and complexity.

Since I've been coding asp.net since 2000, I haven't really had to deal with the issue at all, since the platform is not scripted.

I may be working on PHP projects in the future, and I was wondering if any code generators for PHP exist, or if any good references for building these generators exist. It would be for the Linux platform, not targeted to Win2008 Servers running PHP.

+2  A: 

Why not just build a proper app in PHP instead of going through the hassle? Recent PHP is fully object-oriented and lets you do some pretty decent stuff. There are even frameworks that help you do this kind of stuff.

Jim Puls
+1  A: 

It's better that you learned good development practices in PHP than use code-generators. PHP might be a scripting language but it is quite potent, has a nice OO model, plenty of good frameworks and other open-source packages.

It's up to the developer to create well designed and factored code base, regardless of whether it's compiled at run-time or not.

Eran Galperin
I'm not sure I'd call CakePHP a "good framework"...
Jim Puls
why not? '
Eran Galperin
A: 

I'm rather sceptical on the merits of code generation in the context of a dynamic language, such as PHP. You can generally use other kinds of abstraction to get the same results. Unlike a statically typed, compiled language, it is rather easy to use dynamic hooks such as __get and __set and reflection, to make generic abstract objects.

troelskn