原文名称: 5 ways to be a better php developer
原文链接: [url]http://www.developertutorials.com/blog/web/5-ways-to-be-a-better-php-developer-36/ [/url]英文版原文已经摘抄在本文后面,供参考。
中文翻译: Altair
经常有一些经验不足的PHP开发人员在Freenode的##php IRC频道上问问题。如果问题很琐碎,或者答案显而易见,或表现得象一个菜鸟,很快他们就会发现会受到如下一些回复的炮轰:“去读该死的手册去吧”,“好好去学一学PHP吧”,“我们不是你个人的导师”或更直接的“你需要成为一个更好的PHP开发者”。但是,怎样才能成为一个更优秀的PHP开发者呢?在这篇文章中,我列出了五种成为更优秀的PHP开发者的方法,让你在PHP开发过程中提高效率,用更少的代码来完成更多的事情。在PHP的开发过程中永远会有更多的内容需要去学习,如新的核心函数,新的框架,新的设计模式,新的编码或文档规范等等。下面就是一些成为更优秀的PHP开发者的最佳途径。
1.阅读手册
没什么比阅读手册更值得强调的事了–仅仅通过阅读手册你就可以学习到很多东西。特别是有关字符串和数组有关的函数。就在这些函数里面包括许多有用的功能,如果你仔细阅读手册,你会经常发现在以往的项目开发过程中,很多时候你在“重复发明轮子”,而实际上你只需要一个核心函数就可以完成相应的功能。手册是你的朋友。
2.阅读程序源代码
有很多使用PHP开发的开源程序。为什么不去学习和借鉴呢?下载一份开源的PHP应用程序的源代码,仔细阅读它吧。也许越大的项目越值得去阅读,虽然它们也许有更复杂的结构和系统,但也有更详细的解释文档。如果你不知道从哪里开始,可以看看网站 http://www.sourceforge.net 。
3.学习一种框架
现在的框架如雨后春笋般纷纷出笼;它们中的大部分都是开源的,可以直接从网上下载,当然你要知道从哪里去下载。可以先选择一些主流的框架 — 网站[url]http://www.phpframeworks.com[/url]里有一个非常好的主流框架的列表。
4.研究
在PHP网站开发过程和讨论中你可能听说过很多术语。从OOP到MVC,KISS到DRY,YAML到INI,甚至REST到XML-RPC,也许有数百个与你的工作直接相关的技术概念。你也许对它们有了一个基本的了解,但你真的了解它们到底是什么,对你有什么意义吗?花一点时间去做些实实在在的研究吧。Wikipedia是从事这些研究的很好的起点。你一定会从中学到一些新知识的。
5.学习面向对象程序设计
这也许是上一个方法的继续,但是OOP比你想象的更重要。你真的了解PHP5中OOP是如何实现的吗?例如,你真的了解抽象类,接口,“implements”关键字,静态方法和静态属性,访问修饰符“protected”吗?甚至许多有经验的开发人员都倒在这些问题的面前。如果你能充分利用OOP的特征,你就可以节省很多的开发时间。
就是这些。要想成为 PHP 高手,这是五个最直接而又重要的的方法
附英文原文:
5 Ways to be a Better PHP Developer
Often, an inexperienced PHP developer will hop onto IRC and ask a question in ##php on Freenode. And if the question is trivial, the answer seems obvious or they simply seem like a newbie, they may soon find themselves bombarded with such comments as “RTFM”, “Go learn PHP”, “We are not your personal tutors” or simply “You need to become a better PHP developer”. So, how is it that one becomes a better PHP developer? In this post, I’ll outline five ways to be a better developer, improve your productivity, write less code and achieve more with your web applications.There’s always more to learn when it comes to PHP development. New core functions, new frameworks, new design patterns, new code documentation styles. Here are some of the best ways you can become a better PHP developer.
1. Read the manual
I really can’t emphasize this enough – there’s a lot to be learned just reading the PHP manual. Especially check out the string and array functions. There’s a lot of functionality available right there, and often by reading through the manual you’ll find you’ve been reinventing the wheel in past projects when you could have just used a core function. The manual is your friend.
2. Browse through some code
PHP has a lot of open source code out there. So why not learn from it? Download an open source PHP application and have a read through the code. The bigger projects are probably better, as they’ll have more complex structures and systems in place but also more thorough documentation explaining it all. Check out SourceForge.net if you can’t find a good place to start.
3. Learn a new framework
There are more PHP frameworks out there than you’ve had hot dinners; a lot of them are open source and available online if you know where to look. Try the major ones first – phpframeworks.com has a good list. Your framework can never be entirely complete, your next job may require a different framework and you might just find the functionality of another comes in handy in one of your projects.
4. Research
You’ve probably heard a lot of terminology and discussed in the context of PHP web development. From OOP to MVC, KISS to DRY, YAML to INI, even REST to XML-RPC, there are hundreds of technical concepts out there that could directly relate to your work. You may have formed a basic understanding of them, but do you really know what they are or what they mean for you? Spend some time doing real research; Wikipedia is a good place to start. You’re bound to learn something new.
5. Learn OOP
Maybe this follows on a little from the previous point, but OOP is more important than you think. Do you really know about PHP5′s implementation OOP? For example, are you familiar with abstract classes, interfaces, the implements keyword, static methods and properties, the ‘protected’ access modifier? Even many experienced PHP developers fall down in this area. If you make use of the features of OOP, you could save yourself a lot of development time.
So there you have it. Five, straightforward yet significant ways to be a better PHP developer.