Eric Hogue on April 14th, 2011

Late static binding is one of the new features of PHP 5.3. It came out almost 2 years ago, but it to me that many programmers around me have no idea about it. Myself, I have learned about it around 6 months ago.

The PHP documentation defines late static binding as a way to “reference the called class in a context of static inheritance.” This definition didn’t really help me the first time I read it. Fortunately, there are more explanations in the documentation, and there are good examples. If you haven’t, you should read it.

How Does It Work

To use late static binding, you need a class that inherits from another one and some static methods that are overridden. Take the following code:

class ParentClass {
    public static function normalCall() {
        self::calledMethod();
    }   

    public static function lateStaticCall() {
        static::calledMethod();
    }   

    public static function calledMethod() {
        echo "Called in Parent\n";
    }   
}

class ChildClass extends ParentClass {
    public static function calledMethod() {
        echo "Called in Child\n";
    }   
}

The method normallCall() represent the traditional way of using static functions. The self keyword will call the function in the current class. So no matter if I call it with ParentClass::normalCall() or ChildClass::normalCall(), the calledMethod() of the ParentClass will be called and “Called in Parent” will be printed.

However, the lateStaticCall() method uses the new “static” keyword. With this keyword, the call will be forwarded to the class on witch the original method was called. So ParentClass::lateStaticCall() will end up calling ParentClass::calledMethod() and print “Called in Parent”. But ChildClass::lateStaticCall() will call calledMethod() in the ChildClass and print “Called in Child”.

When Should I Use It

I am really not sure. Personally, I try to avoid static methods. They are often better ways to do it. However, if you have a class hierarchy with static methods and you need to override how they act for some child classes, it can be a solution.

If you used in production code, or know a good reason to use it, I would really appreciate if you leave a comment with it.

Tags: ,

Eric Hogue on April 6th, 2011

Many developers I know never attempt any tech event. I am lucky to live in Montréal where we have plenty of them. The Montreal NewTech calendar shows that we have activities for everyone. And it does not have everything. Some meetings cover programming languages, others are targeted at startups, or tools like WordPress. Even with all those choices, most of the developers around me never go to any of those events.

User Group Meetups

Most user group have monthly meetings. They meetup at a certain day every month to discuss about their subject. I have a family, so I cannot attempt to all the meeting I would like, but I try to go to PHPQuébec, < span=""> href=”http://js-montreal.org/”>JS-Montreal and Montreal.rb meetings. We also have meetings for Java, .Net, augmented reality, Clojure and many more. All those events are free. They are great opportunities to learn about the subjects you like and what surrounds it. The meetups are not always focused 100% on the subject of the group. I have seen presentations about startups and how to finance them at PHPQuébec and a presentation about a freelancer association at Montreal.rb. And most of these events are followed by a visit to a bar, where you can discuss with other passionated developers around a drink.

Conferences

Tech conferences are bigger events. They are usually held once a year. Some are always presented in the same city, and other moves from city to city. Those events bring together many great developers. You get to be around very intelligent people. Not only the speakers, but the audience is also very knowledgeable. When you spend a day learning about 5 or 6 different subjects, you go home tired, but with many ideas on how to improve as a developer. This year, I was lucky enough to have my employer sends the entire team to Confoo, but last year I paid for my ticket, and it was worth every dollars.

Conferences can appear a little expensive, but developers should be able to afford it. Most of them offers an early bird rate that allow to save a few hundred dollars. And some of them are really not that expensive. Last year, I attempted Agile Tour Montreal. For 50$, I had a a full day of training. There is also Day Camp 4 Developers, an online conference that should be held 2 or 3 time a year. On this one, you get 5 sessions of an hour for 35$, and you can also download the videos after the event.

For those who don’t have local conferences, it’s harder. You have to add the price of the plane tickets and a few night at the hotel. Even with this, I think it’s worth the price. I am saving some money to go to an event outside of Montreal next year. I haven’t decided yet, but the PHP Community Conference and Tek are pretty tempting.

What Do I Get Out Of It

The obvious answer is learning. When I go to these types of events, I learn a lot. I am exposed to knowledge I would never come across at work. But it’s only a small part of it. To me, the social aspect of it is as important. Conferences and meetups gave me a chance to meet many developers that share the same passion for programming and learning. During the discussions in the pauses or around a beer after the events, I have had the chance to debate about ideas and learn even more. They also offers great opportunities to add to your network. Who knows, the next time you will need a job, maybe someone you met at an event will remember you.

And recently, I realized that it changed me. I have never been a social person. I don’t like talking to people I don’t know. But this changed a little. I now look forward to those events. They offer me a chance to talk to new peoples, chance I use to dread. And it’s not only for technical stuff, I am not as reluctant as I use to be to talk to strangers.

Tags: , ,

Eric Hogue on March 30th, 2011

When developing web applications, we often run into performance issues. People often blame PHP or MySQL for bad performance, but in most case the answer is not that easy. Blindly trying to optimize random parts of our applications can lead to some uneven results.

There are many available tools to profile a PHP application. Learning how to use them can help us pinpoint which parts are slow. With this information we can pick the optimizations that will give us the best results.

This post describes the installation and configuration of some of them. I tested them in a Ubuntu 10.10 virtual machine. If you want to try those tools, don’t forget that they can greatly impact the performance of you web server when they are active. Installing a tool like Xdebug on a production server is not recommended.

Benchmark Your Application

First you need to benchmark your application. If you don’t, you won’t be able to know if you improve the performance or degrade it. If you make some changes, a gut feeling that the site is faster is not enough, you need to have numbers. Siege is a load testing tool. It will tell you how many request a second your application handle and the response time.

Installing Siege is pretty straightforward, download it, untar it and compile it with make.

tar -xvf siege-latest.tar.gz
cd siege-2.70/
./configure
make
sudo make install
siege.config

Running siege.config will generate a .siegerc file. You might need to edit it and change where the log file is generated. By default, the logs where stored in /var/siege.log and I didn’t want to run it as root. So I uncommented the logfile line to store it in my home folder. You might want to set verbose to false also.

When Siege is install, you can use the following command to execute it for 30 seconds with 5 concurrent connections.

siege -c 5 -b -t30s http://localhost
** SIEGE 2.70
** Preparing 5 concurrent users for battle.
The server is now under siege...
Lifting the server siege.. done.
Transactions: 143 hits
Availability: 100.00 %
Elapsed time: 29.75 secs
Data transferred: 0.27 MB
Response time: 1.02 secs
Transaction rate: 4.81 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 4.92
Successful transactions: 143
Failed transactions: 0
Longest transaction: 1.54
Shortest transaction: 0.94

The results will be appended to the log file. This makes it easy to compare the numbers after you make some changes. You can also see when the performances really start to degrade if you add users.

Xdebug

Xdebug is a debugger for PHP. I already talked about it in my post on Debugging PHP In Eclipse. It can also be used for profiling. You can install it with Apt.

sudo apt-get install php5-xdebug

To configure it, open the Xdebug ini file, on standard Ubuntu it’s in ‘/etc/php5/conf.d/xdebug.ini’. Add these lines:

xdebug.default_enable=1
xdebug.scream=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/tmp/xdebug

This will make sure that Xdebug append a stacktrace to errors. And the scream option will disable the PHP error control operator (@). This way all errors will be displayed. It enable the profiler and change it’s output folder. Make sure the folder exits and that apache can write in it.

When Xdebug is installed and configured, restart Apache and browse to your web application. Xdebug will create some files in the folder you picked. You can then use KCachegrind to view those files. You can install it with this command:

sudo apt-get install kcachegrind

On a Gnome machine, this will install lots of dependencies. But after, you will be able to open the output file from Xdebug. You should get a window that looks like this:

KCachegrind

KCachegrind Output

In KCachegrind you can see where your program spent most of it’s time. How many time a function is called. This information should help identify where you should start optimizing to get the most out of your time.

If you prefer a web front end, you can use Webgrind to inspect the result of Xdebug.

XHProf

Xdebug is a very good tool to check where your bottlenecks are in development. However, you should not use it in production. Facebook developed XHProf a profiling tool that can be used on a production server.

To install it, download the latest version and run those commands:

tar -xvf xhprof-0.9.2.tgz
cd xhprof-0.9.2/extension/
phpize
./configure --with-php-config=/usr/bin/php-config5
make
make test
sudo make install

Edit your php.ini and add those line at the end:

[xhprof]
extension=xhprof.so
;
; directory used by default implementation of the iXHProfRuns
; interface (namely, the XHProfRuns_Default class) for storing
; XHProf runs.
;
xhprof.output_dir=/tmp/xhprof

Make sure to change the output dir to something appropriate on your machine.

To profile your application, you now need to add some code at the beginning and at the end of you page execution. Add this at the beginning:

xhprof_enable();

And this at the end:

$data = xhprof_disable();

$XHPROF_ROOT = '/home/testing/Downloads/xhprof-0.9.2';
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";

$xhprof_runs = new XHProfRuns_Default();

// Save the run under a namespace "xhprof".
$run_id = $xhprof_runs->save_run($data, "xhprof");

XHGui

XHGui is a tool that allow saving the data from XHProf in a database and displaying it in a nice UI. It also comes with two files that facilitates adding XHProf to your silte. To install it, clone the repository from GitHub. And follow the instructions in the INSTALL file. Here are the instructions for a machine using MySQL for storage.

git clone https://github.com/preinheimer/xhprof.git
cd xhprof
ln -s xhprof_lib/utils/xhprof_runs_mysql.php xhprof_runs.php
mv xhprof_lib/config.sample.php xhprof_lib/config.php

Look in the xhprof_runs.php file. There is a create table query. Create a database for XHGui and execute the query. Edit the file xhprof_lib/config.php and enter the information for your system. Don’t forget to set doprofile to true. Also, you need to uncomment one of the section for the paths where XHGui should put its files. There are default values for Windows and Linux.

XHGui comes with two files that makes profiling easier. A header file to start profiling and a footer that will end it and persist the information in your database. To automatically insert them in all your site, add the following lines to you virtual host:

php_admin_value auto_prepend_file "/home/testing/Downloads/xhprof/external/header.php"
php_admin_value auto_append_file "/home/testing/Downloads/xhprof/external/footer.php"

You will also need to create a virtual host for XHGui. Then after your site have been visited a few times, you can navigate to you XHGui installation and you will have a page that list the last 25 runs of your sites. Pick one and you should see a page like this one.

XHGui Run page

From this page you can view a lot of information about your pages. It contains statistics about the time the page took, the CPU and memory usage and the number of functions calls. At the bottom, there is a list of functions with the same information. It makes it easy for you to see where the page takes the most time or resources. This will help you find targets for optimizations that will really impact the use experience on your site or the machine where it runs. You can click on any function and view a break down of the functions it calls.

On the main page of a run and in the functions pages, you can generate a call graph with just on click.
XHGui Call Graph
It gives you a nice visual of the functions called when you display a page. The functions that can be problematics are in red or yellow, so you can spot the easily.

This Is Just The Beginning

This is only an introduction to some of the tools that are available for PHP developers. I want to play more with them, and maybe post more information when I get more familiar with them. If you don’t do any profiling, you should probably try them too.

One important rule when optimizing, always measure. Benchmark before and after every change to make sure you are going in the right direction.

Update 2011-04-01

php|architect announced yesterday their first Annual Impact Awards. They nominated quite a few amazing projects, the choices are not easy. However, I think XDebug is an outstanding tool that impact the work of many PHP developers every day. Derick Rethans is doing some important work with it. He has my vote for the award. If you are a php| architect subscriber, go cast your vote.

Tags: , , , , , ,

Eric Hogue on February 10th, 2011

I have been programming in PHP for 5 years now. I did not choose this language, I had to learn it to work on the code of the company my bosses bought. Since I started, I heard many rants about how bad PHP is. Some where valid, but a lot of them are just blaming the language for bad code written by bad programmers.

I am by no mean an expert in programming languages or PHP, but here is my take on the language I use every day.

What I Love

The first thing that comes to my mind about PHP is it’s ease of use. When I started PHP, I had experience in C++, Delphi, VB and C#. The low barrier of entry allowed me to be productive in it quickly. I lacked a lot of knowledge, especially in web development, but I was able to maintain the existing code right away. I no time I could add new functionalities to the existing code.

The PHP documentation is an amazing resource. It’s available online, but it can also be downloaded in html of chm format. The manual contains everything there is to know about the language fundamentals. It has descriptions of every functions, their parameters and return values. It also contains examples on almost every pages to help understand what the page is about. The manual is maintain by the community, and most of the pages have notes from users that clarifies the subject even more.

Over the last five years I have become a web developer and PHP is targeted at web development. It can be embedded in html to produce dynamic pages quickly. I know this can lead to spaghetti code, but if used correctly if a powerful tool. PHP has many features that makes the life of web programmers easy. Things like writing and reading cookies, sessions handling and file uploading are easy to do.

PHP also has an interactive shell. I learned about this about a month ago. For a long time I hoped that PHP had one. I used the interactive Ruby prompt, I saw it it other languages and every time I was thinking it was a neat thing. But I never though of looking for one in PHP. Then last month I saw it in the manual and now I feel stupid for never searching for it. It’s a great reminder that I know so little and that because of that I am not always using the best solutions for the problems I have. You cannot use a solution you don’t know about. I don’t use the interactive shell much, but it’s a great tool to make a quick test before implementing something.

The community around PHP is fantastic. It is very friendly and forthcoming. There are many use groups around the world. Here in Montréal we have PHP Québec that organize monthly meetups. Once a year, they hold a family barbecue in a park an they occasional do nights in a bar where we can speak with other developers around a beer. And last year with other Montréal user groups they started the new Confoo conference.

This is just the Montréal PHP community. If you look on the web, the worldwide community is nice and helping. In Coder at Work, Joshua Bloch says that when you choose a language, you choose a community. He compares it to choosing a bar, you want good beer, but you also want it to have nice people that hang around. I did not pick the PHP bar, but I am glad I ended up with that bunch.

What I Hate

PHP has a few fiction point. The first thing that comes to my mind is again the low barrier of entry. This is both a blessing and a curse. Because it’s easy to code in PHP, many peoples who don’t know anything about programming are making PHP web sites. Because of this, there is a tremendous amount of bad PHP code out there. Most of the web pages they build have security vulnerabilities. As a result, many people consider PHP a bad language, and think that all PHP programmers are bad. This is far from the true, there are very good PHP developers out there. And there are bad programmers in every languages. PHP just tends to attract the beginners.

One thing that can be confusing in PHP is that the order of some parameters changes between functions. The needle/haystack example is known to all PHP developers. The strpos function takes the haystack parameter first and the needle second. The array_search takes them in the opposite order. The array_map and array_filter have the same kind of inconsistencies with the callback parameter.

Another annoying things to me is that the constructor of a derived class does not call the constructor of the base class. This can lead to some problems because if you forgot to call it explicitly, the properties of the base class might not be initialized. The base constructor should probably be implicitly called on every instantiation. But we would also need a way to pass parameters to the base class constructor. Maybe something like in C++ would do it.

Conclusion

PHP is not a perfect language, there is no such thing. However, I think it is a very good multi purpose language. I was able to be productive with it in a few days when we inherited from a bad code base. Since then I have learn much about it and I still have a lot to learn. The language keeps improving, with version 5 we got decent object oriented programming. With 5.3, closures and namespaces And with 5.4 we will get traits.

PHP as a lot of detractors, it also has some fan boys, don’t believe any of them. Ask for more details, what they think is so bad or good about it. And go ahead and try it for yourself and make your own opinion.

Tags:

Eric Hogue on February 2nd, 2011

Debugging a PHP application can be painful. When I have a bug in my code I tend to use echo and error_log to pinpoint the source of the problem. Then I can usually look at the code and figure out what my mistake is.

But sometime the ability to step through the code is very useful. Looking at the actual values of variable and the actual path taken can point at some wrong assumptions I have about my code.

There is a very good tutorial that explains how to setup Eclipse for debugging PHP. It’s 35 pages long and very easy to follow. This post is just a summary of how I do it on an Ubuntu box. This way next time I need to set it up I won’t need to go through all the document.

Setup XDebug

Make sure that Xdebug is installed on your machine. Execute the following command and verify that you have at least one row with “xdebug” in it.

php -m | grep xdebug -i

If XDebug is not installed on your system, you can can install it with this command:

sudo apt-get install php5-xdebug

You have to allow remote debugging if you want to debug web pages. Edit /etc/php5/conf.d/xdebug.ini and add those lines:

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

Configure Eclipse

Open Eclipse preferences and navigate to “PHP/Debug”. Select XDebug in the PHP Debugger drop down. Go to “PHP/PHP Executables” and make sure that you have an executable configured and that the debugger type is set to XDebug. You might want to have two executables. One to debug web pages and one for cli scripts. Set each one to load the appropriate php.ini.

Since I work on many web applications, I have many vhosts on my machine. So I need to set up multiple servers in Eclipse. Go to “PHP/PHP Servers” and click on New to create a new server. Enter a name for the server and the URL to use and click on finish.

Debugging

When debugging, Eclipse overwrite the include_path from your php.ini. At first I though this was really bad, but after I gave it some though it kind of make sense. This way you don’t have to setup your machine like the server where your code will run. This is useful if your projects will run on different severs that can have different configurations.

You need to set up the include_path for each project. Go to the project properties and click on “PHP Include Path”. From there you will be able to add path from the project, others Eclipse projects or paths on your machine.

Then you can go to “Run/Debug Configurations” and create a new configuration. For a PHP script, pick the correct executable, choose the file to debug and you’re set.

For web pages, choose the XDebug debugger, the server to use and the file to launch. Eclipse will generate a URL for you, but you can change it.

That’s it, now you can add breakpoints and step through your code. You can inspect and change the value of your variables. Debugging like this can be a very powerful tools. But you still need to know your code base if you want to know where to look for because stepping through thousands of line of code can be very long and tedious.

Sources

Update 2011-11-07

One problem you can encounter while debugging in Eclipse is that it does not take into account the files in ‘/etc/php5/conf.d’. This is because Eclipse use the -n option when calling PHP. This tell PHP not to use the php.ini. You can avoid this by creating a shell script that removes the option. I found this great answer on Stack Overflow.

Tags: , , ,

Eric Hogue on January 27th, 2011

Wednesday I went to an event called devLAB Montréal. This is a weekly event that is held in Evocatio offices in the old Montréal. It was my first time there, but it was the third time they held it.

What’s devLAB Montréal?

devLAB idea is to get passionate programmers together and let them work on a small project. This idea is really appealing to me. I see this as a great way to work on something I would not normally at work. It also removes all times constraint. In a setup like this we don’t have to deliver anything. So we can take our time to experiment and try new things. It’s also a great way to work with other developers and learn from them.

How It Went

The event was not quite what I was expected. From what I read and heard from it I though we where going to decide on a project or two and work on them. I know they have a list of projects they want to try from previous meetups. That’s not what happened. Basically, we all sit there and played with different things. Some played with Symfony, some with AdWords. I took the opportunity to try Node.js with another developer that was there. It was fun and a great learning experience, but time went by too fast. I definitely need to dig more in Node.

It’s A Great Event

I liked the time I spent there with this bunch of passionate peoples. I can’t be there every week, I have a family and there are other great tech events in Montréal, but I will go back as often as I can. I want to see how it will evolved. What I would like is to pair with others on a small projects. Something that is different from my day to day. The good news is that they look very open to ideas.

I would really like to thank Evocatio for letting us use their office and making this kind of events possible.

Tags: , , ,

Eric Hogue on January 25th, 2011

Last week I read the book Driving Technical Change by Terrence Ryan. This is a small book. I took me only 4 days to read it. Here’s what I thought of it.

The book is divided into four parts. The first part is an introduction, the second part describes the types of skeptics, the third part the techniques and the last part describe strategies to put it all together.

The Introduction

In the introduction the author explain why the book is necessary. There are also two chapters on defining the problem with try to solve and making sure that the solution we try to push is really relevant to the problem we face. This is probably one of the most important part of the book. Programmers love to learn new things and play with new toys. So we have to make sure that we are not trying to push one of those new toy just for the fun of it. If the solution is not appropriate to the problem we face, it could be bad for the project. It can also damage our reputation and get our team to believe the tool is bad because it was use in the wrong project.

The Skeptics

In the second part of the book, the author describes the different types of skeptics we might encounter when trying to get our team to use a new technique. For each type, he gives an example of how they manifest themselves. The examples are little exaggerations, but they are meant to help us recognize the skeptics when facing them. He also says that someone can fit multiple patterns, he can also change type from a project to another one.

The Techniques

This part is the reason why I bought the book. These are the actual techniques to convinced others to accept the new technology. For each techniques, the author explain how to use it and gives examples of the technique applied. He explains why the technique works and on which type of skeptics it is efficient. He also list the pitfalls of using the techniques and how to avoid them. Then he ends the chapter with tips on how to put the technique in practice.

The strategy

This is where the author puts it all together. Because in any team you might encounter many type of skeptics, and the techniques do not work on all types, you need to focus your actions. Here the author describes which skeptics you should try to persuade first. He then explain how you can use them to help you convince the others and get your changes accepted.

My Take On The Book

I really enjoyed this book. The author uses a lot of story telling. The stories are entertaining and they illustrate the point he is making in the chapter. They help visualize the skeptics and the techniques to counter them.

As someone who tried many time to bring innovations at works, and failed most of the time, I believe this book might help me improve. After all, when I fail to convince my teammates and my boss to use something that will help us deliver a better product, I fail at doing my job. As a developer it’s my job to produce the best possible product in a timely manner. And if I know of a new way that will help my team make a better job but I can’t get it adopt, I don’t do a good job.

Knowing the skeptic types will also help me avoid being one of them. I can use this knowledge to see if I oppose an idea for good reasons or if I am just someone else skeptic.

Tags:

Eric Hogue on January 20th, 2011

About a month ago, a very animated discussion took place on the Software Craftsmanship Google Group. The debate was about studying at home vs spending time with the family.

I know I am late in the discussion, but this is a subject that is important to me, so I wanted to add my two cents.

The Family Is Important

No one is denying that our families are important. However, some people seems to think that those who practice, and try to improve as developers are neglecting their family. This is far from the truth for me and for many more I’m sure. My family is very important to me. My girlfriend and my kids are what’s driving me to improve. I love them very much and I want to spend as much time as I can with them. Because contrary to what some would have you believe quantity is as important as quality in that matter. Quality time does not happen on a schedule, you have to be there to experience it.

Learning Is Important

As developer, self improvement is a must. There are lots of us who don’t make the effort of learning new things and practicing. They can have fulfilling career, but for some it’s not enough. Every day I try to learn new things. And every day I find things that I don’t know. I want to become a master in my profession and the more I learn, the more I find out that I have a long road ahead.

It’s possible to learn on the job, but it’s hard. In most companies, there is no time to experiment. There are deadlines to meet. At home, you can decide what you want to learn. You set the time frame. It doesn’t have to be all in one week. You can take your time, learn at your pace. Create toy projects and throw them when you’re done. And if you discover something great that could help you in your job, you now have some expertise on the subject. That should help you sell that new technique to your colleagues and managers.

We Can Have Both

No one have to pick between their family and self improvement. You just have to manage your time wisely. To me, it means leaving the office at 5pm. Then I can have a nice diner with the family. Give my son his bath, play with the kids and watch tv with them. Then after the kids are in bed, I have an hour or two to read, program and try new things. I also have some time early in the weekends.

Do I have to make sacrifices? Of course. Time is limited. When my son was born I had to give up the gym. It was a hard thing to do. I use to love going to the gym in the morning. But I picked my priorities and I had to let go of something. In the end I spend my time doing what makes me happy in life. Spending time with my family and learning to become a better developer.

Tags:

Eric Hogue on January 16th, 2011

I have been programming in PHP for 5 years. PHP was not a choice I made, I had to learn it when my bosses acquired a company that was using Perl and PHP. At this time, I had to switch from doing desktop applications in C# to doing web applications with PHP. This was a major change in philosophy, and at the time I didn’t know much about web development.

I learned the language and most of what I know about the web by working with it. Today I think I have a decent knowledge of the language, but I know I have some gaps. If I never had to use a part of it, my knowledge of this part is probably limited.

Get A Better Knowledge Of PHP

The main reason I decided to take the ZCE exam, is the preparation. By studying for the exam, I get a very nice revision of the core features of the language. It forces me to take a new look at many things I have taken for granted. By doing it, I also learn some new things. I didn’t know that in PHP you could use ‘And’ and ‘Or’ instead of the ‘&&’ and ‘||’ logical operators. By reading the manual, I learned about those, and I also learned that they have a different precedence.

I have also learned that the empty array evaluate to false. I could have easily try that and find out, but it never occurs to me to actually use an array in a conditional. When I want to do something only when an array as some element, I check the count first. Now I know that I can just use the array. I’m not sure that it’s a good idea, it might make the code harder to understand, but at least it’s a choice I will make.

These little things I learn are great, but I thing the bigger value will be when I’ll learn about functions I did not know existed. I might come across functions that perform things I always do manually. Using a function that is built in the language should make my code easier to read for the other developers who knows about them. They will immediately understand what the piece of code do. It should also make my code more concise by taking out some of it’s complexity directly into the language.

Learn The New Feature Of PHP 5.3

Another great thing about my preparation is that it will forces me to learn a little bit more about the new features of PHP 5.3. I already know the big additions to PHP, but I still use 5.2 at work and on the servers where my personal projects are hosted. So I don’t get to really dig into those. It’s one thing to know that PHP 5.3 have namespaces, closures and late static binding. But it takes more to master them and the way they are used in PHP. Studying them will give me a little more knowledge about them and push me to actually try them on my own. Plus, looking at the new features page in the PHP Manual, I can see that there is more than those features.

Will It Help Me Find A Job?

No, it should not get me a job. It might attract a few headhunters, but that should be it. I have a job and I don’t want to change now. Having a Zend Certification does not make someone a good developer. It shows that when he passed the exam he had a great knowledge of PHP. But it takes a lot more than the knowledge of a language to be a good programmer.

I will never hire someone because he have a ZCE, and I would not want to work for someone who hires based on something like this only. However, the certification might help get your resume on top of the pile. Especially in place where HR filters the resume based on keywords. When your resume goes into the hands of none technical persons, they might give the ZCE a great values and make sure your resume gets passed along. But in the end, in any decent company, you will have to prove your knowledge if you want to get hired.

On My Way To The Exam

So at the end of last year, I decided that obtaining my Zend PHP 5.3 Certification was one of my goals for 2011. I hesitated for some time before deciding to get it because I was not sure about it’s value. I had a nice conversation about this on Twitter with @Richard_Tuin, @alister_b and @PoweredByJAM. In the end I decided to do it for what I could learn from it.

I already started my preparation and I wish to give the exam a try at the end of February.

Tags: , , , ,

Eric Hogue on January 13th, 2011

Wednesday, the date and the line up for Day Camp For Developers 2 (DC4D) was announced. I immediately bought my ticket and I wish to convince you to do the same.

What’s DC4D?

DC4D is an online conference aimed at helping developers in their career. During the conference, the speakers won’t talk about code. The sessions are about how a developer can improve his career. The first event was about soft skills. And it was great. It had talks about open sourcing our career, technical writing, writing better resume, managing our career and being an architect.

It was an inspiring day, and I ended up many great ideas. This is the day where I decided to finally start a blog. It took me a few months to actually do it, but that’s another story.

The second event will be held on March 5th, and it will talk about telecommuting.

Why Should I Attempt?

If you are a developer, this event is for you. The talks are tailored for an audience of programmers. Since there is no code involved, the programming languages you use are not important.

For 35$ you get 5 inspiring talks. Even better, you can download the videos after the event and watch as whenever and has many time has you want. This time, there is even a ‘Office Party’ ticket that you can buy for 100$ if you want to watch it with colleagues or friends.

Another great thing about DC4D, is the IRC room. Usually, conferences are a great place to meet new peoples. In an online conference you loose some part of this, but the chat room made up for it. Throughout the day, it was filled with great comment about the subjects discussed by the speakers. Some of the speakers event came in the chat room after their talk.

But I can’t telecommute

I have the same problem. My employer don’t like telecommuting. He accepts it once or twice a year but he made it pretty clear that he doesn’t like this. I still think this event is a must. First they will give ideas on how to convince your employer that it can make sense for him to allow developers to work from outside the office.

Also, you probably won’t work for the same employer for the rest of your life. Your next job might be in a year or ten, but they might be more open to the idea. So if you are already prepared it will make it easier for you to convince them.

What Are You Waiting For?

Go ahead, buy your ticket. I’m sure you won’t regret it.

Tags: ,