Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I haven't done any serious web development stuff since last year because of family/time issues. I need to get back into it because it's my career choice and I'll be finished with my associates degree soon. I decided to revamp a previous website I helped the owner build. After deciding what to change, I couldn't make up my mind if I should continue with writing procedural code or move to a framework. I know without a doubt I can do it with procedural code but I'm undecided between it. I guess I'm looking for a second opinion, what would you do if you were in a similar situation?

share|improve this question

migrated from stackoverflow.com May 6 '11 at 21:06

This question came from our site for professional and enthusiast programmers.

5 Answers 5

up vote 4 down vote accepted

That is a false choice.

There are a lot of php "frameworks" which actually are written in procedural style.

Instead of trying to find some magical framework which would bestow upon you the wisdom of programming , you should just learn how to write code in OOP manner. Here are few books that might you help with that :

You will notice that only 2 books in the list are strictly PHP, because the methods and ideas of OOP are not restricted to single language.

And, i would recommend to you to stay away from frameworks until you have learned how to write good code and understand the concepts and implementation of MVC. Because there does not exist a php framework which does it correctly ( there are some better , some worse, but all have issues ). That would cause you to learn bad coding practices, which then would be hard to get rid of.

share|improve this answer
1  
CakePHP and symfony are fine frameworks with documentation that explains MVC and its benefits. It's not a bad way to cut your teeth on the pattern, either. It may not be how MVC was originally conceived but it's definitely how many are using it for the web today. –  webbiedave May 6 '11 at 22:15
1  
@webbiedave I would really disagree with that , but lets not start a flame-war. Just refresh your knowledge of MVC and watch some youtube lectures on "unit tests". –  teresko May 6 '11 at 22:32
    
Thank you, I'll check those books out. –  AllofHumanity May 6 '11 at 22:55

I know without a doubt I can do it with procedural code

You should consider more. For instance, it should include things like:

How can I produce an application that is not only functionally complete, but is more likely to be engineered bug free by employing tested libraries and will be easier to maintain (not just by me but by others) by using proven, known methodologies.

Frameworks (framework != OOP as there are procedural frameworks) and patterns aren't there just to help you get things done faster, they're also there to allow your application to be more reliable and easier to understand by using time-tested standard approaches when possible.

share|improve this answer

First of all, you do not need a framework to write OOP PHP code. So "Procedural vs Framework" aren't your only options.

That being said, it depends on the size of the project. If its very small I would use some procedural PHP, a little larger then I would use some OOP PHP, if its a big project I would use a framework.

You should also already be comfortable with PHP and OOP before starting an MVC framework in my opinion.

share|improve this answer

I think any time you are working on learning something new you are on the right track. Whether that is going to a PHP framework, learning about OO PHP, or switching languages alltogether it doesn't matter.

The more different things you learn the more marketable you will be. Also, knowing a few things really really well will also make you more marketable.

It's really easy to get caught in the black hole of trying to pick the "best" or "perfect" framework/language/technology for your project but at the end of the day it just doesn't matter

I'd recommend just trying out things that interest you and you think that you'd enjoy. This way you will be learning with less effort and you will have more fun working on your projects.

share|improve this answer

I started writing object-oriented code a while ago. And I strongly suggest you to start diving into OOP. Not necessarily frameworks, just start with the basics of OOP and in time you will feel the need for a framework.

The truth is OOP seems very complex at start, but once you get the main ideas and structures you will find yourself writing more reusable and logically structured code. Also, by using a framework and OOP code, other developers will be able to modify your code just as easily if it was their own. It's also better for team projects. Everyone can work on a different part of a website and conflicts are minimal, if any.

And if it's your career choice, sooner or later, you will be forced to work in a team that requires some sort of OOP and/or a framework.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.