views:

858

answers:

15

I have been working with PHP for years and gotten a very good grasp of the language, created many advanced and not-so-advanced systems that are working very well.

The problem I'm running into is that I only learn when I find a need for something that I haven't learned before. This causes me to look up solutions and other code that handles the problem, and so I will learn about a new function or structure that I hadn't seen before. It is in this way that I have learned many of my better techniques (such as studying classes put out by Amazon, Google or other major companies).

The main problem with this is the concept of not being able to learn something if you don't know it exists. For instance, it took me several months of programming to learn about the empty() function, and I simply would check the string length using strlen() to check for empty values.

I'm now getting into building bigger and bigger systems, and I've started to read blogs like highscalability.com and been researching MySQL replication and server data for scaling. I know that structure of your code is very important to make full systems work.

After reading a recent blog about reddit's structure, it made me question if there is some standard or "accepted systems" out there.

I have looked into frameworks (I've used Kohana, which I regretted, but decided that PHP frameworks were not for me) and I prefer my own library of functions rather than having a framework.

My current structure is a mix between WordPress, Kohana and my own knowledge.

The ways I can see as being potentially beneficial are:

  • Read blogs
  • Read tutorials
  • Work with someone else
  • Read a book

What would be the best way(s) to "get to the next level" the level of being a very good system developer?

+2  A: 

Learn to do what you already know ... in a different way. Examples:

  • in a different language
  • on a different platform
  • in parallel/distributed
  • through a framework (yes, you decided that they "aren't for you" - maybe try a different one, they are sometimes very different from each other)
Piskvor
+1 nice listing
Shyam
+28  A: 

Everyone who wants to be a PHP programmer, always takes only first word and completely ignores second.
While "programming" is WAY more important than "PHP". To be a PHP pro, one should be a programmer in the first place.

So, I'd vote for the last one - reading books. Not on PHP but on the programming in general. Grady Booch's, Martin Fowler's and even old Knuth's ones.
It would be also nice to take a look at some other languages, like Java or Python. Not to switch to them but to learn from them.

Col. Shrapnel
Okay -- thank you for the direction. I took PHP as I have studied other languages, such as C, C++, Classic ASP, ASP.NET, just all to a basic degree, thanks!
Kerry
That's true. But what do you mean by "other languages"? Why would a web programmer need to know about things only specific to desktop applications? It always puzzles me why the answer to "becoming better at a specific language" is always to "learn another language" and receives so many upvotes. Is the answer to becoming better at speaking Italian to study Latin? Some people would say yes, but in my opinion it's not worth the time learning another language that you won't be using just to indirectly make it "easier to learn" the other language.
Lotus Notes
And sorry for the double post, but I can't edit. The OP specifically asked for advanced PHP knowledge. Maybe I'm just naive, but the only things you really transfer freely between programming languages are design patterns (which you can learn in pure PHP if you want), algorithms (very situational for web programming), and general good practice. I find most of the time "learning" a language is spent figuring out the specific libraries, standard or not. The only real problem is that programmers who start with PHP rather than a language like C++ or Java have a harder time using OOP.
Lotus Notes
@Byron: The last sentence in your second comment is contrary to all the rest you're saying.
stagas
I would also like to add that if you look at some other languages, such as Ruby, you might quickly consider switching from PHP :) I'm in the same spot as you and I am now seriously considering ditching PHP.
Tom
@Byron Learning English made me more conscious about my native German, studying Japanese significantly improved my English and my knowledge of grammar overall. Learning Javascript expanded my thinking about functions and objects and dabbling in Haskell and Ruby is showing me many interesting concepts which reflect on my PHP skills. So I'd definitely argue that yes, learning something else improves your "main" language. Studying Latin would surely increase your understanding of most European languages.
deceze
@Byron: Knowledge of how desktop applications (or other programming languages for that matter) work will help you keep an open mind and can be very useful to think "outside the box". That's something you learn through experience.
wimvds
@Byron - Even if only to _appreciate_ what the higher level language is doing for them through insight of what its actually doing. I.e. memory management .. or the marvel of `$i = "foo"; $i = 1;`. Its one thing to appreciate abstraction, but ignorance is not always bliss :)
Tim Post
Kerry
Forgive me, but the first word is an infinitly recursive "P". The second word should be understood as "Hypertext". After all "PHP" is an acronym!
Christopher W. Allen-Poole
+1 for 'learn another language' - I've actually developed solutions in PHP which I have learnt from Python and C++ applications
HorusKol
While this isn't the answer I was looking for I do believe this is the answer that most are looking for (I learned several other languages prior to PHP and after PHP, such as C++, AHK, ASP, ASP.NET/C#), I am marking this as the answer as I do believe it could help many in that situation.
Kerry
@Kerry most of my answer not of other languages but of books. I didn't think that language remark would raise such an argument. And I still insist that Fowler's "Refactoring: Improving the Design of Existing Code." and and Booch's "Object-Oriented Analysis and Design" can bring you to the new level.
Col. Shrapnel
Ahh, okay, thank you very much, I will look into those :)
Kerry
A: 

You should work with examples, work with them when you expand them so you will learn how to expand examples by making them more functional and give out more features.

Although, it is good to create something that you've learned so far in PHP. To practise more, you should create something like, a booking system, etc. Sooner or later you will be able to expand more by learning more when you study more in PHP which will lead your development to be much more better.

YouBook
+9  A: 

Here are a few thoughts:

  • Try different things. Learn a new language. Some times in the process of learning that other language, actually makes you better on both.

  • Contribute to an open-source project.

  • High scalability and PHP/MySQL are not friends. There are technologies today that are build just for that. node.js and Redis to name a couple.

  • Answer questions in SO. Other people's problems can make you think outside the box and you improve on the process of trying to help, and you also do something nice to someone.

  • [ will try to add here if I think of anything else I just woke up drinking coffee :D ]

stagas
I disagree with high scalability and PHP/MySQL are not friends, for instance, Adobe uses MySQL and Facebook uses PHP. Unless you meant the combination of them together? But I still doubt that. Everything else is great
Kerry
@Kerry: You're right. Don't use those silly things. Forget I even mentioned them. Big companies sure know better. Good luck with that!
stagas
@Kerry: While it *is* possible to achieve high scalability with PHP, it is not the optimal tool for the job and it will take more time effort than using appropriate tools/technologies.
Piskvor
@Kerry: What is your point? The US Navy uses Windows 2000. :DPHP performs poorly and that is why facebook works on hiphop: http://developers.facebook.com/blog/post/358 . The point is, that it is always cheaper to buy new servers then to rewrite your app for a better platform. But if you're writing an app from scratch, you should take time to choose a good platform. SQL is from 1974 and Adobe's AS3 is just a 90's Java mock. Try open up and use new technologies and approaches. Especially if you want to become good.
back2dos
Hard to take that advice at face value from someone with a username of @back2dos :p
Tchalvak
@Tchalvak: lol, good one :D I suppose you understand the difference between nostalgia and conservatism ;)
back2dos
Heh. Fair enough.
Tchalvak
@back2dos -- but the Navy's main area is not computers. Facebook, is. They have over 60,000 servers and have rewritten their code numerous times, they have had the option to switch from PHP/MySQL, and they didn't. Yes, they use HipHop, but they write in PHP. That doesn't mean that HipHop can't be implemented from the beginning.
Kerry
@Kerry: Do you really think, Facebook has more computers than the Navy? And frankly, if the circuitry within their aircraft was running PHP, their pilots would be shot down, before they'd have the time to react, and if they were programmed the same way "Web 2.0"-apps are, there wouldn't even be the need to shoot them down. If you read the post, you would've seen, they actually subtly admitted, their engineering team is not able to handle the learning curve required to work with a proper language. Any other server language except ruby will outperform PHP, HipHop or not.
back2dos
@back2dos -- I didn't read that post because I've read numerous others. Did I ever say that Facebook has more computers than the navy? No, good way to put words in my mouth. Also, if you're going to make ridiculous accusations and claims (such as PHP and pilots... there is no way a pilot can react in 0.0001 seconds, where PHP can easily do calculations), also I see a huge lack of references and a lot of flaming. Yahoo!, YouTube and Wikipedia all use PHP. Those are some of the most trafficked websites on the net.
Kerry
@Kerry: http://tinyurl.com/5nezt9 this is the first, I found (google php performance comparison). But feel free to go and look for benchmarks yourself. What can I draw from the "fact" that *the Navy's main area is not computers. Facebook, is*? The point, that facebook needs to run 60000 servers shows the problem. If you run the numbers, this is actually my point. According to the post, Facebook serves 400G pages/Month, assuming 25% of the servers are front tier, comes down to an avg of 10 pages per second per server. Stackoverflow runs on one server and definitely serves more pages than that.
back2dos
@Kerry: I'm sorry for having been a little rude the other day, but it seems too me, you're clearly to impressed by big players, and that you have not seen much on the server side except PHP. I've grown a little tired and nerved from explaining PHP developers, why PHP sucks in numerous points. PHP is a tool, and as any tool, it is good for some tasks and bad for others, high scalability being not the right area for PHP. This is measurable. And the big players using PHP you mentioned solve it by throwing tons of servers at it. Frankly, that doesn't impress me.
back2dos
@Kerry: The number of computers is not entirely relevant; think about what happens if some servers of Facebook crash, it seems to happen quite often: some part of the site is not displayed for a few seconds, e.g. you don't see some of your friends actions. Annoying, but inconsequential. What happens when a controller computer for Navy crashes? Possible loss of life. Quite a difference.
Piskvor
+1  A: 

The best you can do is to buy a book on efficient algorithms. In every computer science student's life there comes a time he/she has to study those. The problems that are discussed/solved there are abstractions of almost any real world problem you may ever face.

Besides that reading blogs about how others did it is perfectly fine as it helps you to understand how to practically use (and maybe even implement) the principles of efficient algorithms.

Regards.

aefxx
can you recommend a good book?
Shyam
A: 

"my own library of functions" == "a [idiosyncratic and probably sucky] framework".

I recommend learning Symfony because the developers seem to consistently strive to do everything according to "best" practices ... but you could probably learn a lot from any of the popular frameworks.

Don't write your own framework. Please.

Nathan
To judge what I've done before you have any idea what it is both insulting and idiosyncratic.
Kerry
The less your code (or ideas) have been seen, challenged, critiqued and corrected by other people, the less likely they are to be as awesome as you think they are.
Nathan
What a silly answer. There is nothing wrong with writing your own framework. I did it with a friend simply because we wanted to and had the time to spare. We now use our own framework for our apps and can develop quite quickly in it. Its not that there was anything wrong with using another FW, just that we wanted to create our own. so we did. I personally grew a lot as a developer by taking part in it also, gave me a much greater understanding of MVC.
Christian
@Nathan: You are working by probability with is lacking thousands of factors. To make any judgement based on such limited knowledge is folly.
Kerry
-1 Sure, dont write anything at all. I mean Symfony came out of the blue skies right? Now, thats a good answer...NOT
Shyam
-1 Fine, if someone is paying you for a system which will need maintenance, or if you're working with other developers, then don't write your own framework... but if you want to learn, writing your own framework is an _excellent_ exercise, and this question is explicitly about learning and growth.
LeguRi
@Richard JP Le Guen: a key point in becoming a good developer and not just beeing some geek in love with programming is being able to learn out in the field, while creating apps that are meant for deployment, and not staying in the cellar hacking together whatever you think will be the one framework to rule them all. because you can't. software is imperfect and you can only become good, if you accept that fact and make the best of it instead of playing around.
back2dos
@Shyam: that was not the point. And I think you know it.
back2dos
@back2dos - I agree, trying to write "the one framework to rule them all" is foolish - but I still think that if your focus is on learning and not on writing that perfect framework, then writing a framework is an excellent exercise... so long as you know that on some level; the framework is not the ends, it is the means.
LeguRi
if nobody 'wrote their own framework' then we wouldn't have any frameworks - that said, you probably shouldn't start until you've gained a lot of experience using several other frameworks for many more applications
HorusKol
I've done it and seen it done both ways. That's why I recommend using and contributing to an existing framework. You'll also learn more than making your own awesome framework from scratch. It's the same with many other disciplines, like cooking, science, music, math...
Nathan
Stupid answer....-1
Night Shade
A: 

You could ask your company if they could pay you a Zend PHP Certification exam. Studying for this exam would oblige you to know php well and to train by reading a lot of the documentation, the Zend study guide, and also by training with mock exams. It's a very efficient way of improving, and it looks quite good on a Résumé.

greg0ire
Wouldn't that be more targeted on the framework than the language?
Shyam
I'm talking about the PHP Certification, not the ZF Certification. I passed it and there was not a single question about the framework.
greg0ire
+1  A: 

I would join discussion boards and try to solve other peoples problems. Sometimes there are quite challenging questions out there that force you to do some research. If you can't answer it, you can wait for someone who can and learn something then.

As for frameworks, learn from them. I roll my own too, since most of the frameworks out there can be rather slow. Although fast enough for most of the websites out there.

I would also recommend looking at Facebook's PHP lib. They do some interesting stuff in there.

Brent Baisley
Thank you for that last sentence.
Kerry
Welcome to StackOverflow :)
Shyam
+1  A: 

Not enough can be said about working with other developers. I know 3 developers especially, 2 that I work with on a day to day basis, who blow me away with their knowledge. I ask their opinions on everything I do, not because I second guess my own ideas, but more that I want to hear other ideas, especially from people who I respect as developers. I learn more from these people than any other means. If you have no access to other senior developers, then definitely post on SO or other dev forums and ask peoples opinions, ask people how they would approach a specific project/issue. You wont learn new techniques / methods / functions generally unless you see them being used (how do you know what to look for if you don't know it exists?)

Also, as already stated, take part in an OS app. Go to sourceforge and find a project needing a developer. Or download an app and try to write a plugin for it (I am writing a plugin for Invision 3.0 atm and learning a few things.)

Hope that helps.

Christian
That greatly helped, thanks.
Kerry
+2  A: 

Maybe you should look into frameworks again, I would suggest having a look at the Zend Framework, because it's more like a library of components you can use as you see fit, and doesn't really impose a rigid structure you have to follow (like some other frameworks do), though it does suggest a (quite sane imho) project layout. A good starting point would be Surviving the deep end.

Things you haven't mentioned yet, and that could prove useful to know (especially in larger projects) :

wimvds
Will Zend reduce the speed? Most frameworks reduce it DRASTICALLY (I looked at bench marks and even those that boast of speed, compared to those without frameworks, were much slower)
Kerry
If you use autoloading then yes, it will reduce the speed. If using lots of different components, then yes, it will reduce the speed. But the flexibility (and standardisation, not only for you, but for future employees/colleagues) you gain outweighs the downsides of using a framework imho. Though of course, it's something you have to decide for yourself. You can easily cache chunks of output if needed. But the nice thing about Zend is that you can use only the components you want/need in your apps, instead of the whole enchilada, and mix it with other code as you see fit.
wimvds
BTW Using an opcode cache (XCache, Zend Optimizer et al) can drastically increase the speed of your scripts, if you're worrying about speed (though of course you'll end up using more resources - memory/disk)...
wimvds
+1  A: 

Read other people's code. You have your own library now, yet you might get some enlightenment when reading the source of other applications. Then ask yourself the 'why's. Be the blog writer, instead of the reader. Also, emphasize more on the programmer than the language. Rather look at solutions that already solve a problem and try to replicate them with your own knowledge. Good luck and have a lot of fun!

Shyam
Kerry
I've been in the same situation as yourself (I think most programmers have been, with exception that were born with a 500lbs manual inside their brain). I found myself getting 'better' by reading the CodeIgniter source and understanding what was going on further more in depth. Especially because it is targeted at performance. Good judgement comes from experience, experience comes from writing code and reading others (its like reading a book and understanding the humor between the lines).
Shyam
+5  A: 
  1. Look into hidden features of PHP and PHP's predefined interfaces
  2. Learn different languages. Learn languages that have a steeper learning curve than PHP. Any time I point out advantages of other languages over PHP, I am accused of PHP bashing, mostly be people who quite obviously never really mastered another high level language. But I'm gonna take the risk. I suggest Ruby, Python, Pearl and haXe (as a strictly typed counterpart). Once you did it, try applying your new knowledge to PHP. Or just move away from PHP, in case you don't wanna go back (which I think isn't unlikely to happen).
  3. Learn to deal with critisizm. Your reaction to Nathan's post showed quite clearly you can't deal with it yet. He is absolutely right.
    • Looking at my first PHP framework now, I have to say it was quite shitty. At the time I thought it was great (and it still is better than a lot of production code that I've already seen deployed). Still, it had many flaws. Unless you're a total genius, your first frameworks will just look awfully if you look back at them a few years later (assuming you evolve).
    • Actually, any framework you will create will look worse as time progresses (assuming you don't stop evolving). For this reason you might just as well use available frameworks and focus more on application development. If the framework you use has limitations, consider contributing rather than writing yet another PHP framework.
    • The point in time to choose writing your own frameworks (not just for fun/learning, but for production deployment) is when your requirements surpass what other frameworks out there offer and not when you just don't like the idea of working with one. It's a common mistake, which I have done myself. But now I can say, I've learnt from it. But if you ask for advice (which I unfortunately didn't do at the time) you will get answers like these.
    • You learn a lot from working with code you did not write yourself. Not only do you pick up concepts promoted by frameworks others put a lot of thought into, but you also learn to be productive, flexible, able to work in a team and to get the job done (while obtaining reasonably good results).
    • I suppose you can't really think you're better than every team of a PHP open source project out there, otherwise you would ask. Get over the stubborn instinctive need to reinvent the wheel any young developer has and grow up to tackle problems noone has tackled yet.
  4. Learn, what the difference is, between a component library and a framework. Since you think you can replace a framework with "your own library of functions", you probably haven't understood, what the point of frameworks is. Have a look at dependency inversion, inversion of control and dependency injection.
  5. Learn about software design. Look at OO principles like SOLID and GRASP.
  6. Try different paradigms. AOP, functional programming. Enhance your OO skills using languages with stronger object orientation, such as Ruby, Objective-C or Smalltalk.
  7. Look at PHP frameworks such as Flow3, Symfony, PHP igniter and CakePHP. I've already pointed out why I think you should do so.
  8. As pointed out in another comment of mine, you should consider other storages than RDBMs. SQL and OOP really don't go well together. Have a look at OODBMS, different database abstraction layers, key-value-stores, document stores such as CouchDB and MongoDB, distributes caching servers as memcache etc.

Good luck then.

greetz
back2dos

back2dos
+5  A: 

I prefer my own library of functions rather than having a framework

You refer to a 'library of functions' and 'a' framework' as distinct concepts (good!) so why not try and up the ante a bit and turn that library of functions into a framework? Mind you this is a great way to learn but not the best way to have marketable skills ;)

It's also a great way to learn wrong so before you start you have to do some research.

The "must have" features

There are certain features almost all frameworks have, and there's a reason for that. Research them; find out why they are present and what their variations are; choose which implementations you'd prefer to include in your framework.

  • Object Oriented (this is key to why you'd write a framework as opposed to just using your library of functions)
  • Use of Patterns (check out and start asking yourself why so many frameworks use Application Controller as opposed to Front Controller... and are there some platforms which use Page Controllers?
  • Basic MVC structure
  • Clean URLs

Features of non-PHP platforms you want to understand and emulate

I have no idea what interests you so I'll stop there.

Publish it!

This part is important, because Nathan is right: your work has to be seen, challenged, critiqued and corrected by other people. Don't leave that lamp under a bushel - it needs to be seen; put it on Google code or sourceforge or something, and if people are going to bother looking at it seriously you need to take it seriously; you need to maintain unit tests and regression tests; you need to use version control; you need to comment it well, with a big /* header comment */ at the top of each file and useful doc-generating comments for each class and member thereof.

Summary

If you do all this, you can learn (at a high level) about other platforms. You can definitely "ding 40" as a PHP developer. You can learn about unit testing; about regression testing. You can learn about documenting effectively.

Guaranteed your framework will come out "idiosyncratic and probably sucky", but you can learn a lot from writing it. Just keep in mind that the framework isn't a product; it's a journey... of sorts.

LeguRi
Just for the sake of argument ;)
LeguRi
Ha, thanks Richard. Unfortunately right now we're understaffed and working on 3-4 major systems at once, so I don't have time to build an actual framework. While I can clearly see the advantages and reasons to do so, I also go with the idea of not reinventing the wheel. Rather than make my own I see myself sooner digging through another framework and finding their virtues and vices.
Kerry
Thanks for the props :D
Nathan
@Nathan - np... thanks for focusing on the props and not on my -1 :S
LeguRi
@RJPLG - Meh. Rough crowd around here! The commenters on Perl questions are classier :P
Nathan
+1  A: 

The approach to look at at other programmers code is definitely a good way to learn "good" or "bad" practices. After reading other code you develop a "feeling" for good code.

I definitely recommend Frameworks like Zend Framework, symfony, CakePHP or Agavi because a lot of contributors look at that code and develop them constantly towards the "ideal" solution (which of course will never be reached...) ;) You still can make the decision developing your own classes instead the ones the framework offers...

With such a long PHP background you could consider contributing to an open source framework. Discussions with other developers bring you forward in a faster way.

Showing your code to others and ask for constructive feedback has the same effect. You never know how good you are until you benchmark your skills with others. Always in a constructive manner. This would be a natural process when contributing to an open source framework. ;)

udo