Becoming a PHP Professional【part 1】The Missing Link

这是我上次给大家介绍的那篇文章,今天放在这里,希望大家都能尽快变得Professional 

Becoming a PHP Professional:

The Missing Link

When reading various PHP related blogs, Quora questions, Google+ communities, newsletters and magazines, I often notice extreme polarization of skill. Questions are either at the “How do I connect to a MySQL database?” level or something in the range of “How do I best scale my mailing system to send over one million emails per hour without introducing a new server?”

I personally distinguish between 4 distinct levels of PHP prowess (likely applicable to any language/profession):beginner,intermediate, professional and elite.

The extremes

In PHP, beginners learn about variables, includes, form processing. They learn simple logic constructs. They send an email with the help of a tutorial, maybe even touch on an object oriented programming example without actually understanding it. They work with Word Press and modify a couple CSS classes. With this knowledge, they apply for jobs and, unfortunately, usually fail.

Professionals are those who have given good parts of their lives to many projects. They’ve deployed commercial applications in most if not all frameworks, they’ve used different databases with PHP efficiently, they visited and/or talked at conferences. They studied design patterns and can easily engineer an entire project on their own from diagrams to execution. They left procedural code far behind.

Elite programmers are professionals who put in the fabled 10000+ hours into honing their skill. They supplement their PHP installations with extensions they wrote themselves, they find bugs just by glancing through source files, they are extremely meticulous about their code layout. They reject all but the most complex projects and find alternative and imaginative ways to solve problems people didn’t even know they had. They’ve written some well received books about the language, spoke at dozens of conferences, maybe even made their own branch of PHP or a highly successful framework or two.

So in all this, who are the intermediate ones?

The missing link

How does one get from beginner to pro and beyond? If one doesn’t know anything beyond the basics, how can they improve their skill enough to leave the bad practices behind and start practicing the more advanced approaches? This is a question I get asked a lot by beginners. In order to become a professional, one must first become intermediate.

What follows is a list of what one should go through on the path to PHP fluency.

Abandon spaghetti code

Many people think using classes means you’re writing object oriented code, while using functions means you’re writing procedural code. While this is false, for the sake of this argument, let’s assume the widespread vanilla definition: procedural code is code in which you simply don’t use classes and objects, and OOP code is code in which you use classes and objects as much as possible.

My advice is to fully abandon procedural code. Use object oriented coding style as much as possible – write classes, encapsulate logic, think with real world terminology. The performance benefit of procedural code over class based code is negligible when compared to the re-usability that proper OOP code gives you and future developers inheriting your project. A common argument against this is “But, Word Press is procedural!” To be frank, and this might sound harsh, “Word Press developers” are no more PHP developers than people with Instagram are photographers. Please don’t take this to mean WP is useless – it’s fantastic for blogs, simple websites and one-day projects you don’t want to spend too much time on. It’s excellent for making a quick buck or for people who aren’t too technical, but mastering WP will never make you a professional PHP developer – it’s a yarn of spaghetti code that can teach you no proper design principles.

Start small. Think of a real world concept, and try to represent it in OOP code. Work through some basic tutorialsand slowly go more advanced. Work on OOP code until you understand classes in general before transitioning to proper frameworks and confusing terms like “Model”, “View” and “Controller” – all these are foggy, abstract terms without having a solid foundation in OOP first.

Dissect existing projects

Dive into existing source code wherever you can find it. For example, look up PHP projects on Github, clone them, deploy them locally on your own machine and try to play around with the code. Go file by file, line by line, until you understand what each does.

Look for projects that are well commented and/or documented, well structured, and still alive. Projects last updated in 2008 won’t do you much good if you’re getting into PHP 5.5 – you’ll likely be missing out on the latest and greatest features that could make you stand out in an already overpopulated field.

Learn to set up your own PHP environment

Being able to set up your own environment is a priceless skill. Not only does it allow you to fine tune your setup, it also familiarizes you with building extensions from source.

Abandon Windows for development – if your main desktop is Windows, install virtualization software and run a Linux virtual machine – the case insensitivity of Windows, its line endings, and all other oddities inconsistent with most server environments out there are just asking for trouble, so it’s best to develop on a system that most resembles the environment you’ll eventually be launching on.

Virtual machines also help you experiment – if something goes wrong, you can just wipe it and start over or do a rollback. You can literally experiment as much as you want without fear of messing anything up. Mastering tools is important, but having a good workbench is too.

Experimenting with your own setups will also allow you to get familiar with the different servers out there – whether to use Apache of Nginx, whether to use neither of them and go with Appserver, and so on.

Exercise best practices early

When writing your own code, make sure you comment heavily with docblocks, indent beautifully and structure carefully. After you build a class, project or library, use well known documentation tools (PHPDocumentor,ApiGen) to extract the docblocks and improve on them.

A good IDE is worth its disk size in gold – getting used to one multi platform editor can help you be up and running in no time when setting up a fresh environment, so you can dive into code instantly without wasting time on setting up keyboard shortcuts and themes. Make sure you back up IDE configuration files on a cloud service like Google Drive, so you have them ready for import at all times even if you need to make a fresh installation. A good IDE isPHPStorm, or if you can’t afford it or have no open source projects with which to ask for a free license, Netbeansis a free alternative. Both are multi-platform.

Getting used to best practices early helps you remain consistent and lets other people read your code much more fluently. Find your style and stick to it – you’ll help both yourself and others. Try to follow the PSR standards (PSR-0, PSR-1, PSR-2, PSR-3) as closely as possible – they’re called standards for a reason. Most of us use and love them, and they make everyone’s code equally reusable and readable.

A good beginner friendly resource that gives up-to-date hints is PHP the right way – use it to get familiar with the latest best practices, basics of OOP, security, deployment, coding standards I mentioned above, and much more.

Try out different frameworks, choose one

For a long time, PHP was the language with most frameworks out there (JavaScript took over recently). Whether this speaks of the inconsistency of our community or the popularity of our language, I cannot say, but the fact remains that choosing a framework is a daunting task, especially when first starting out.

Having tried most of them, I can wholeheartedly recommend Phalcon as the go-to framework due to its robustness and quality, and the fact that it’s built in C and installed as a PHP extension (thus being faster than any current framework in existence). However, trying out different frameworks is an absolute necessity.

When you try them out, you learn about a new approach to a common problem every time. Each framework has its own quirks you’ll like and downsides you’ll hate but most importantly, you’ll learn about the mindset of others (particularly the developers of the framework). You’ll see new usages and approaches, and a very good exercise is re-building one of your sample projects in as many frameworks as you can find. This will help you efficiently gauge the efficacy of a particular framework: the speed of developing in it and its performance.

Read

Don’t underestimate the hints and tips of others. Read as much as you can – if you keep at it, it doesn’t take as much time as you might think. Find good blogs to follow, read the tutorials on this website, traverse questions and answers on StackOverflow, visit the SitePoint Forums, subscribe to newsletters, follow good sources on Google+. Avoid basic PHP tutorial books – they’re outdated as soon as they’re published – instead, focus on individual snippets and tutorials of useful up-to-date code you can find all over the web. Even if the topic is something you’ve already covered, try giving it a read – you’ll often find that something new can be learned by reading someone else’s perspective on the very same thing.

If there’s no work, invent some

There is always something to do. Never catch yourself saying “I don’t have a project” or even worse, “I’m bored”. If you don’t have an active project to work on – make one up. Do you use a tool daily that frustrates you with its lack of functionality? Build a better alternative! Have no ideas for new products? Replicate existing ones – tryrebuilding a basic Facebook, recreate something you already know exists just for practice.

What’s most important is to never stop – there’s no amassing 10000 hours if you don’t put in the hours! Keep working, keep yourself interested and engaged. Make a simple address book app. Then rebuild it in another framework. Then rebuild it with another database (replace MariaDB with Mongo, for example). Keep busy!

Find a buddy/mentor

It’s easier to learn when you have someone to do it with. Find a buddy who shares your passion. Maybe you’re one of the lucky few with a partner who shares your geeky interests. Maybe you’re in school or university and have peers who would like to get started as well and need companionship in these adventures. You can even find a mentor and receive expert guidance.

Never underestimate the power of a companion – there’s a reason The Doctor always has one!

Conclusion

When you focus on all these entries with as much will as you can muster, when you realize it’s what you want and keep at it – you’re on the road to becoming a PHP pro. Maintain discipline, never give up (even if others around you do) and keep practicing.

If you’ve got any useful resources you’d like to share with us on how you bridged (or are currently bridging) the Intermediate gap, let us know in the comments below!

*************************************************************************************************原文有4篇,分四次发布。
2014年6月30日

Share

【非技术】纪念死而复生的电脑

经过一个晚上的折腾,电脑又活过来了。这里再次特地感谢@国文,一枚专业的OS Killer :能搞坏系统不牛X,能把搞坏的系统重新复活才牛X。恩,有美女的电脑系统坏了可以找我这位室友,收不收费,学妹得看美的程度,学弟得看萌的程度。恩,是这样的。

Go语言那本书在蓝杰,今天下午去帮学姐搬寝室,于是原本要写的那篇博客又没有完成,明天一定写完!

今天要说的是什么呢?

1、电脑文件做好备份,最好把代码、文件、照片等等东西存在云上,百度云盘和金山快盘都是很好的选择,以下是两个盘的地址,用户名是 【mengqingshare@163.com】密码是【mqshare2014】一共大概有4个T,大家当然也可以自己申请一些空间啦:

http://www.kuaipan.cn/

http://pan.baidu.com/

2、电脑的C盘其实不需要太大,但也不能太小,一般80G为宜,并且保证C盘永远都有20G的可用空间,桌面上的文件最好一周一次整理和备份,重要的文件最好不要放在C盘。

3、安装软件的时候一定要一步一步走,避免安装捆绑软件,常见的捆绑软件大户为腾讯电脑管家、百度电脑卫士、360电脑卫士等等等等,而金山系的一般有金山毒霸、猎豹wifi以及多玩游戏神马的,并且这些软件很多都是默认开机启动,会搞得自己电脑开机速度变得超级慢。

4、安装软件的时候一般去官网安装,别上神马华军软件园啊,太平洋软件啊之类的,这些软件经常有捆绑,并且恶意篡改浏览器主页,很不要脸。

5、使用猎豹、谷歌等浏览器的时候最好登陆账户,这样就会将自己收藏的网页啊浏览的记录啊神马的记录下来,一遍重装系统以后啥都没了。但是这个仅仅限于自己电脑,网吧啊学校电脑啊最好不要登陆自己的账号。

6、很多网站允许QQ号码登陆,别着急,在用QQ号码登陆的时候一定要看好授予的权限,有一些事必选的,但是很多都是可选的,这些最好看一下,要不你的空间腾讯微博就会经常出现一些莫名其妙的东西。

7、软件安装包最好也备份一下,重装系统的时候就不用花流量去下载了,并且也不用害怕下载错误的不匹配的软件。

8、文件架最好分好小类,那种一级一级的文件结构看起来繁琐,但是在查找起来会非常高效,文件夹命名的时候最好是见名知意。

就说这么多吧,总之电脑重生了真的很高兴。

还有给大家悄悄介绍一个浏览器【天行浏览器】

刘凯宁@C2P
2014年6月29日

 

 

Share

【非技术】写在电脑重生的前一个小时

都是敲代码的,谁的电脑没崩溃过那么几次啊!

恩,2014年6月27日,天气不错哦。电脑第一次崩溃。

事情是这个样子的:前一天晚上看德国和美国队比赛,大概2点结束,德国1比0小胜美国但是克林斯曼和勒夫还是手牵着手一起出线了,然后看完就睡了啊。早晨9点起床,打开电脑,这个时候还是好的呢,然后上上网:水水空间,看看新闻,逛逛知乎;继而和室友一起去吃饭,吃完饭回来继续上上网,然后聊聊QQ之类的。2点多,关机,装好电脑,去蓝杰。嗯,噩梦就是这样开始了。到蓝杰以后,按开机键,出去倒杯水,打开Go语言写写博客,写到一半,屏幕一黑!恩,一黑!!黑!!!再按开机键,选windows系统,说没有正常关闭,得修复,或者依旧正常启动。点正常启动。机子卡了。一直卡着。20分钟没动!强制拔电池阿我就这么点手段阿!拔了电池,开机,还是选windows,还是原来那个,那点自动修复。恩,开始修复了。说会一个小时吧大概。没关系啊等着呗。然后15分钟过来以后,机子屏幕是黑的,按什么都不动了!恩,开机键。还是一样……拔电池……【我只会这个……】然后就是一如既往的卡顿。我觉得我的电脑是有了一些脾气了,我需要给他一点时间让他自己玩一会儿,恩应该是这样。(*^__^*) 嘻嘻……然后我过了一个小时回来以后竟然能够让我输入密码了!恩,那么这是不是就意味着可以使用了!卧槽不是啊,还是那个熟悉到圈圈一直转啊转的!我有强迫症阿我一直觉得!再等等先,于是又等了五分钟。于是还是不行。于是我又强制关机了。昨天本来是要写Go语言到基本语法以及那些很可爱到特性,却没想到机子一直不给力一直打不开。从下午3点到蓝杰到6点吃饭机子一直没启动,期间帮邵珂学姐讲解了一点Android还有给一个学弟讲了点SQL语句,还给他改了几个PHP的错误。吃完饭机子还是卡,卡就卡吧大不了今天我就不用了呗。没想到一语成幾【这个单词常常用于表现乌鸦嘴那种情况】,机子就是没启动起来。晚上0点回到宿舍,到0点30机子依旧没有启动。本来喝了点酒心情不是那么好,直接把机子一关上床睡觉了。第二天,就是今天,10点,开机,依旧开不开。我不是一个很有耐心的人,我虽然看起来和和气气到其实哥也有脾气的!
恩,亲们,给点个赞呗,点到100我就重装系统。现在是19点26,我刚刚看了已经有了72个赞了。没办法,重装呗!呜呜呜!

还有孩纸会问我为什么能写这篇文字,(*^__^*) 嘻嘻……哥哥双系统哦!(*^__^*) !

今天天气真好!

Share

【C2P】优秀学习网站资源汇总

工欲善其事,必先利其器。

Technology is a tool.

It helps us accomplish amazing things, hopefully more quickly and more easily and more amazingly than if we hadn’t used the tool .

Before we had newfangled steam-powered hammering machines, we had hammers . And before we had hammers, we had the painful process of smacking a nail into a board with our bare hands.

Technology is all about making our lives better and easier. And less painful.
–––– Ryan Henson Creighton,<Unity 3D Game Development by Example>

于是我们就需要用技术来改变世界。

特整理优秀学习网站如下,与诸君共勉!


 

HTML前端基础:

http://www.w3school.com.cn/

JavaScript :

http://www.javascriptsource.com/

http://javascript.cs.lmu.edu/

http://www.jb51.net/list/list_3_1.htm

CSS:

http://www.divcss5.com/

前端设计:

http://www.sitepoint.com/

http://www.shejidaren.com/category/css/css-learn

HTML5:

http://www.html5cn.org/

http://www.52html5.com/

http://www.html5tricks.com/

jQuery:

http://api.jquery.com/

http://www.php100.com/manual/jquery/

http://www.jqshare.com/

jQueryMobile

http://api.jquerymobile.com/

http://www.jqmapi.com/

ExtJS

http://extjs.org.cn/

http://www.sencha.com/forum/

Android:

http://developer.android.com/index.html

http://www.apkbus.com/

http://www.android-doc.com/index.html

iOS:

http://www.cocoachina.com/special/fornew.html

http://v.163.com/special/opencourse/ios7.html

Java:

http://www.javaweb.cc/JavaAPI1.6/

Struts2:

http://struts.apache.org/release/2.1.x/docs/home.html

Spring:

http://spring.io/docs

Hibernate:

http://hibernate.org/orm/

开源:

http://www.oschina.net/

http://www.open-open.com/

http://tool.oschina.net/apidocs/

PHP:

http://phpeasystep.com/

http://www.php.net/docs.php

http://www.php100.com/

http://www.phpchina.com/

CodeIgniter (CI ):

http://codeigniter.org.cn/

ThinkPHP:

http://www.thinkphp.cn/

<持续更新中!>


 

学无止境

不忘初心

诸君加油!

2014年6月3日

刘凯宁@C2P

Share

【C2P】坚持为赢

很多很多事情看起来很艰难,但是其实只要坚持下去用心去做,收获那是必然的。

今天晚上开会的最重要内容就是: 在暑假期间,所有C2P团队成员每天更新一篇技术博客

这是最快速提高技术水平的方法,我想大家不会有什么反对的吧。

坚持两个月,每天进步一点点。 用户名:电话号码

密码:姓名首字母+电话号码

例如我自己: 用户名:15200806084

密码:lkn15200806084

有登不上去的、不会写第一篇博客的,请尽快私聊我。


博客要进行分类,我已经写好了分类目录,请大家在自己的分类目录下面写博客哦!

  用两个月时间的Concentration让自己变成Professional

C2P。

坚持为赢!

诸君加油!

刘凯宁@C2P

2014年6月26日

Share