Hacker News new | ask | show | jobs
by Ixiaus 5828 days ago
PHP works well as a DSL for web applications; I recently switched from PHP to Python + Pylons and am noticing significant differences in workflow. So significant that I can see, precisely, why PHP is so dominant. Python's features as a language completely overthrow those of PHP, though - I have no reason to go back.

I've had my eye on Scheme as a potential web application environment for a year now. Maybe I'll make the jump soon, Racket (PLT-Scheme) looks like it would beat CL + Weblocks in maturity.

3 comments

> I recently switched from PHP to Python + Pylons and am noticing significant differences in workflow.

Can you elaborate ?

I'm noticing that the idiom for WSGI based frameworks, is to "layer" applications (middleware), a lot like an onion. Certain actions/functionality is only available within specific layers of that onion. I quickly found out you can't just call redirect(url('some_route')) from within your helpers (or any module outside of the callable controller); the exception will be caught, but instead of redirecting it will display it as an error.

In PHP, unless headers have already been sent, you can call this: header("Location: blablablabl") from wherever.

That's just one example of the difference in workflow, it took me some getting used to before I could appreciate it. There are many other "little" things such as above, that are different.

I'm loving Python + Pylons, the more I use it the more I get used to the workflow too...

I did the same, and the only difference in workflow I've observed that isn't positive is how I have to constantly restart Apache.

If a project is absolutely tiny, like 10 lines, or utterly disposable, I'll still do it in PHP. Otherwise, I'd sooner quit coding and take up nude karaoke than do a new project in PHP.

Before jumping ship to Scheme, consider CL + Uncommon Web. It has a steep learning curve and documentation is no where near the level of Hunchentoot + CL-WHO, but UCW is a great framework for developing web applications and is used extensively by the Tech Co-op for real-world apps.