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'm a beginner programmer

I have been learning PHP for a while, though not consistently. But for the past few months (say 3 months) I have been a bit consistent in my learning, largely because of a project a friend ask me to do for him since he knew I was into web design. Though I struggled to complete the tiny project for him after about 3 weeks, because I got stuck some times and I have to look up tutorials/references relating to the problem I was trying to solve, but I feel fulfilled been able to accomplish a project and along the way grab most of PHP basics.

My interest in Web development has grew higher since completing that project and I have been trying to learn PHP/MySQL as fast as I could, because the same friend want me to do something else for him, which to me is way beyond the basics I know. Though I don't charge him anything, but it gives me a sense of fulfillment.

I want to learn a framework, because I heard it can make you accomplish more as a web developer and makes life much easier.

Can I learn a framework without having OOP knowledge? I know how to create and use functions, though I don't use it much

I know my question is not straight forward, but I know you will understand were I'm coming from and advice me appropriately. I wish to become a professional Web Developer.

I really need your professional advice.

share|improve this question

3 Answers 3

In PHP, most frameworks use both OOP and MVC pattern. It means that you have to know both. Maybe not know them very well, but at least have a basic idea of what are those things, what are their strong points and weaknesses and how to use them.

As for when you should start learning a framework, for PHP, I would say use PHP framework as soon as possible, for several reasons:

  1. PHP by itself is a language which does everything to encourage you to write bad quality code. Different PHP frameworks try, on the other hand, to, not force, but encourage you to write a better code.

  2. A framework provides an abstraction. It means that:

    • You'll write less code most of the time,
    • You'll see some minor performance issues.

This means that:

  • It is a good idea to use a PHP framework most of the time, unless you're really sure that it doesn't worth it and you will be faster writing a native PHP code with no framework at all,
  • The PHP framework may not be a solution for very large websites requiring high performance. Chances are you will not work on those projects very often, and if you do, you will first have to profile your code to determine that the bottleneck is the framework itself.
share|improve this answer
    
@anonymous downvoter: don't you believe that explaining the reason for the downvote would both be polite for the author of the answer, and useful for the community? –  MainMa Sep 10 '11 at 18:58
1  
i didn't downvote, but i agree with SteB's answer that it is important to learn the fundamentals of a language before learning a framework. yes, frameworks are great and make things simpler/better, but if you rush into the easy approach, you'll learn less. if you're doing this as a job and not just a hobby, you won't always have the luxury of building your projects from scratch, and if you're handed a project someone else wrote, you need to be able to understand what is going on. –  Jeff Hawthorne Jun 12 '13 at 18:22

I've been through a similar thing myself, learning PHP in my spare time as an exercise with an eye to helping a friend who runs an online game.

I found that the differences between PHP and my "work" language (Delphi) meant I was better off starting with the absolute basics of PHP and it's syntax, without any framework or OOP to get in the way. There's also a huge amount of online help (particularly the php.net website) which doesn't use a framework or OOP.

While this online code can be of varying quality, it can still help a beginner to get off the ground and start producing working code, which encourages me more than anything else to keep going and improve.

Once I got past this stage, I started looking at using OOP in PHP and rapidly progressed to a framework (codeigniter) on my friend's recommendation.

So, YES! Every PHP programmer should seek to learn OOP and a framework, but only once they've got to grips with straight, rough'n'ready procedural code (even if it's inline).

It's about learning in stages so you don't bite off too much at once, you should seek to progress as rapidly as possible and be wary about bad programming habits (which are everywhere in PHP), just keep learning and improving, that's what I'm still doing!

share|improve this answer

Yes, I think one should learn a framework in whichever web language they are using, even if it's just for open source or hobby work. I think the amount of OOP needed depends on the framework itself, but that is also good knowledge to have. Probably best is to learn a popular framework as it helps when you collaborate with others on projects. The frameworks also help to avoid the trap of writing hard-to-maintain "spaghetti" code. Even on your own projects you will become the maintainer of legacy code.

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.