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?
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 :
- Patterns of Enterprise Application Architecture
- Agile Software Development, Principles, Patterns, and Practices
- SQL Antipatterns: Avoiding the Pitfalls of Database Programming
- PHP Object-Oriented Solutions
- PHP in Action
- Clean Code: A Handbook of Agile Software Craftsmanship
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.
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.
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.
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.
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.