4 ms·
So now we have PHP, which started as a lightweight script language, following Java down the road toward a more verbose style, and so now we need code templates?
by lkrubner 12y ago
So now we have PHP, which started as a lightweight script language, following Java down the road toward a more verbose style, and so now we need code templates? Java programmers have been doing this for awhile, they rely on IDEs such as Eclipse or IntelliJ to write some of the boilerplate for them, and that is important in a language like Java, which has so much boilerplate. But with Java, that boilerplate at least buys you something: static typing and type checks, which allows the compiler to check for bugs, and which offers immense benefits in terms of speed. In PHP, we get... what? Apparently PHP is now verbose enough that people feel the need to write code templates for it, but what benefit do we get in exchange for all of that boilerplate? PHP is still dynamic, and it is still very slow.
This seems like the worst of all worlds.
- asocial 12y ago>Apparently PHP is now verbose enough that people feel the need to write code templates for it It isn't though. PHP is many things but overly verbose isn't one of them * . Although there does seem to be a drive by some developers to make PHP look and act as much like Java as possible. Maybe this comes from discomfort at PHP not being structured or strict enough out of the box for their liking. If you've only ever dealt with well-engineered languages which have a certain, coherent set of patterns and paradigms baked in, and which demand you write your code a certain way, and you approach PHP, you're going to have a problem. I don't know why a tool like this would be useful, but it wouldn't be because of the language. PHP exposes its own token parser - you can generate PHP code with much less abstraction than this. *classes like IteratorIterator aside...
- debacle 12y agoPHP has a real glut of talented programmers right now, which is why you're seeing the same overengineering that plagues Java. Fun problems have dozens of solutions because everyone wants to work on them. Templating is just one of those. Weird, case-specific conventions are another.
- Gigablah 12y agoThis isn't really anything new. Yii and Symfony have been doing code generation for years. Someone simply decided to create a library that's not framework specific.
- debacle 12y agoThe problem is that everyone is creating every library, over and over. It is a real problem in PHP that there is no single, polished solution and every framework is being reinvented (and breaking BC) constantly.
- Gigablah 12y agoThat's why I hope StackPHP gets some traction and more people create framework agnostic libraries (e.g. phpleague).
- debacle 12y agohttp://xkcd.com/927/ http://xkcd.com/927/
- Gigablah 12y agoThat's cute. What's your solution? Stick with CodeIgniter?
- lkrubner 12y agoOr go work on original problems that have not already been solved dozens of times. Projects like this are a waste of talent. There are clearly some smart programmers writing libraries for PHP. The question is, why do they keep writing the same stuff, over and over? All of humanity would benefit if some of these smart people focused on doing something domain specific (medicine, law, education) or dove deeper and helped re-invent the stack at a deeper level. Maybe re-invent PHP as a language that has primitives for concurrency. Or leave PHP and work on other problems that plague the tech industry (the obsoleteness of HTTP/HTML as a way of delivering documents, when people increasingly want software over TCP, not documents).