Live data from Hacker News

Ask HN: I program in pure PHP - Should I be doing something different?

news.ycombinator.com

1–10 of 18 posts

Ask HN: I program in pure PHP - Should I be doing something different?

#1
I graduated from a state university with a degree in Marketing, but I started programming as a junior in high school. Besides a few high school courses, I have no formal training and program for the web in php with no frameworks (except jquery for javscript/ajax functions).

I see a lot of rapid development discussion and I like cranking out relatively simple websites quickly, but I think I am limited by the programming techniques I am using. For example, I programmed (isWearing.com and SmarterFootball.com), and I used a lot of the similar features into a prototype I made this past week (foodmarkit.com). All three sites are relatively uncomplicated (mostly database driven), but it took a long time to recreate the same basic processes. I'm assuming "there's gotta be a better way". So... what is out there?

I've heard a lot about django, ruby on rails, pythong etc... What do you think is the best option for me and rapid development?

Re: Ask HN: I program in pure PHP - Should I be doing something different?

#2
but it took a long time to recreate the same basic processes.

Are you using Drupal? if you are doing a lot of the same boiler plate it may be because you are not using a CMS that will allow you to reuse components across sites. Something like Drupal may help you to make your UI components more reusable while still allowing you to use PHP.

Re: Ask HN: I program in pure PHP - Should I be doing something different?

#3
Welcome to the world of web development! You are going to be recreating a lot of stuff (especially if you are going to be working for a corporation). I have a little experience with using djano but, I do most of my work in PHP. I have started to like Zend Framework(ZF) and I would recommend that to you as you already know PHP (instead of learning django, ror, etc.). ZF should speed up your development a bit. These days, I mostly prefer doing Sys Admin stuff and playing with Javascript and I shudder at creating a web app from scratch. When I am not working for money, I do not force myself to create a web app. But, when I do start working on something I tend to work extremely hard.

Re: Ask HN: I program in pure PHP - Should I be doing something different?

#5
CODEIGNITER

I use a variety of languages and frameworks, and CodeIgniter is the closest to what you described you're used to with some great boiler plate code. I've done everything from simple one off CMS apps to very robust multi site automated apps, all in Codeigniter.

Check it out, it's easy to get started with, you don't need the command line, there's no magic. Just helpful code.

Re: Ask HN: I program in pure PHP - Should I be doing something different?

#9
The best option would be to pick a framework and learn to use it. I may get flamed for this view, but I don't really think it matters as much which framework you choose, just choose one and learn to use it well. Invest time in to learning with it on a throwaway project.

You will not be as productive end-to-end on day 1 as you are with your current tools - that's OK, because after learning a framework, you will be more productive than pure hand-coding for any web-app of any complexity. You'll likely be safer, because there's been more effort put in to most frameworks to help protect against web attacks (SQL injection in most cases).

Learning a framework will teach you to think differently about your development process, as well as introduce you to a community of like-minded developers all using the same tool. It will help you develop a development process.

You'll get to the point where you're comfortable and productive, and then you'll start noticing limitations in whatever framework you're using. That's the time to start looking for another one, and either jumping over to using that, or more ideally, looking at what ideas and components you can reincorporate in to your current tech stack.

I love Grails (Java) because, while it's niche, it makes model-drive development a snap. I create classes, identify relationships, and the system can generate the db layer (tables, etc) for me automatically. There are ways to do some of this in PHP, but the language itself makes this extremely verbose. However... I still use PHP (now using zfkit as a basis) for some projects, and have done some .Net work where it made sense (on an MS-only project, to be precise).

It's easier to jump around now because I've spent time understanding not just the particular languages involved, but thinking about how web apps are commonly abstracted (MVC, service layers, db layers, etc). Understanding those common patterns makes it easier to swap between frameworks and platforms as needed.

Gentle plug - I'm working on a starter kit for zend framework - zfkit.com - which aims to bring a somewhat better 'out of the box' experience to ZF (at least from my perspective). You can download and it's bundled and preconfigured to use the Doctrine ORM tool. That said, if ZF and Doctrine rather make you say "huh?" it may not be for you just yet. :)

Re: Ask HN: I program in pure PHP - Should I be doing something different?

#10
There are a lot of PHP based frameworks along you want to deal with the verbosity of the PHP language.

Two types of frameworks : "Full stack" and "glue" "Full Stack" are more automated and 'easy' to start and create CRUD. "Glue" are more powerful, full of libraries but less automated and a learning curve more demanding.

Full Stack - Cakephp - Symfony - Kohana - CodeIgniter

Glue - Pear - Zend Framework

The two extremes are Cake and Zend Framework

If you want to stay with PHP try Kohana. If not, Rails (Ruby) or Django (Python) are the best out there.

I recommend you to stop deciding and start doing something with one of these.

Post reply on HN