How to increase my "advanced" knowledge of PHP further? (quickly) [closed]
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开发者_如何学Python
- 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?
Everyone who wants to be a PHP programmer, always takes only the first word and completely ignores the second.
While "programming" is WAY more important than "PHP", to be a PHP professional, 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 the old Donald Knuth's ones.
It would be also be nice to take a look at some other languages, like Java or Python. Not to switch to them, but to learn from them.
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
- If you like Ruby perhaps you'd want to a means by which to
include
modules in classes? - If you like Asp.NET maybe you'd want to try creating Server Controls in a PHP environment?
- Upset that forgiveness is the default with HTML? Why not validate output server side
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.
- Look into hidden features of PHP and PHP's predefined interfaces
- 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).
- 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.
- 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.
- Learn about software design. Look at OO principles like SOLID and GRASP.
- Try different paradigms. AOP, functional programming. Enhance your OO skills using languages with stronger object orientation, such as Ruby, Objective-C or Smalltalk.
- Look at PHP frameworks such as Flow3, Symfony, PHP igniter and CakePHP. I've already pointed out why I think you should do so.
- 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.
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 ]
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)
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) :
- OOP with PHP (design patterns)
- Unit testing (PHPUnit, SimpleTest, ...)
- ORM (Propel, Doctrine)
Simple: do it. Needs will make you learn. Find a way to get involved in increasingly advanced projects, be it commercial or open source. There is no other way you can really learn something.
I would join discussion boards and try to solve other peoples problems. Sometimes there are quite challenging questions 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 library. They do some interesting stuff in there.
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.
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.
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!
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. ;)
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.
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é.
"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.
精彩评论