Hacker News new | past | comments | ask | show | jobs | submit login

Would an appropriate compromise be to recommend "if you're going to learn with PHP, make sure you use a framework" since using any of Symfony/Laravel/Cake/etc will guide/force you into slightly better habits than writing PHP from scratch would?



Part of the downside I was trying to convey is that a lot of the PHP work available is maintaining or fixing truly horrible applications, and that while skilled PHP developers are as productive as skilled developers in any other language, unskilled/novice developers are much worse as a consequence of learning all the wrong lessons from random code examples that they find through search engines.

It is actually quite difficult to deliberately create a web application in Python that is as bad as one of those "shopping cart with all the HTML, SQL, JS, and CSS interleaved in a single PHP file" examples that a novice will find and learn from. A novice is highly unlikely to manage it through ignorance even if they somehow manage to avoid using a framework.


I think as a PHP developer I jumped to defending PHP without understanding the nuance you were aiming for, sorry about that. I definitely agree with what you're saying.


No worries, the particular cause-and-effect nuance is subtle enough that a lot of people misunderstand it, which suggests that my phrasing is at fault.

And while the attractive nuisance of PHP's Turing-completeness that encourages those anti-patterns is annoying, it isn't entirely unique:

The platform I cut my development teeth on in 1998 (Zope[1], written in Python) also had a template language that was Turing-complete called DTML[2]. It was a painful transition for the community to deprecate DTML in favor of the new Zope Page Templates (ZPT)[3] that implemented a deliberately less powerful syntax[4][5].

The advantage of a less powerful template syntax is that it forces all "business" application logic (as opposed to "view" logic) out of the templates and into Python code.

Unfortunately, for deployed applications this was a lot of extra work that could only be justified in terms of increased maintainability, which was an even harder "sell" to managers back then.

[1] https://www.zope.org

[2] https://docs.zope.org/zope2/zope2book/DTML.html

[3] https://docs.zope.org/zope2/zope2book/ZPT.html

[4] https://en.wikipedia.org/wiki/Template_Attribute_Language




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: