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: ,

Eric Hogue on January 11th, 2011

When I need to do something like a search and replace across multiple files, I usually write a PHP script. I always knew I could do it faster with grep and sed, but I was too lazy to research how to do it. Last week I finally decided to find a better way. I’m entering it here so I can easily find it back.

You can use this technique to replace any string you want. For example, to change a class name you would do something like this:

grep -RlZ OldClassName * | xargs -0l sed -i -e 's/OldClassName/NewClassName/g'

grep

grep will search through files for a regular expression. The R option make the search recursive so it will go down in the the directory structure. The l option tells grep to output only the names of files where it found a match. And with Z, grep will separate the results with \0 instead of \n, we will see later why this is necessary. You can also add the i option if you want to make a case insensitive search. After the options, we give grep the expression to search for and the files we want to search. In our case, we only search for a class name, but we could have used a regular expression.

xargs

xargs is a tool used to build a command from the standard input. So instead of writing a loop to go through the results from grep and passing them as parameters to another command, we let xargs take care of it. It will execute the given command on all the files returned by grep. We give xargs the -0 option to tell it that a \0 instead of the whitespace it expect. This will allow us to process files with whitespace in the name. The l option is used so xargs will pass the file names 1 line at the time to sed.

sed

sed is a stream editor. It take text from a stream (a file in this case), edit it in some way and output it back. In this case, we will pass it all the files found by grep and ask it to replace all occurrence of OldClassName with NewClassName. To make sed act on the files found by grep, we pass then using a pipe and xargs. We use the i option to make sed edit the file. If you give -i an extension, it will create a back up of the original file. The e options tells sed to add the string between quotes to the command. This is the regular expression to be executed. In this case, the expression is pretty simple. The s tells sed to replace OldClassName with NewClassName. The g at the ends make it global, so it replace all occurrences.

Other Uses

The value of learning this technique is that it can be used to replace any string you want. With regular expressions, you can use it to replace a phone number across multiple html pages. It doesn’t matter if there are hundreds of files, and if the phone number is repeated many times in each file. Just build the correct regex and you’re set. And with the flexibility of regular expressions, you can replace one phone number, or any phone number found on your pages. If your files are under source control, you can easily look at the diff before committing the changes made by sed. If they are not, start by putting them in source control.

To me, this command shows the power of command line tools. They are built in a way that makes it easy to use them together, passing the result of a command to the next one. I really need to work on my knowledge of them and start using them more in my daily tasks.

Tags: , , , , ,

Eric Hogue on January 8th, 2011

Here are my goals for 2011. I am making them public to increase my motivation. Having them visible to everyone makes me more committed to them than when I was keeping them private. It will also leave a trace so I can make a retrospection at the end of the year.

So here they are in no particular order:

Start A Blog And Keep It Alive

I already started the blog. That was the easy part. Now hopefully I will keep on posting through the year and after. I aim to post a least once a week.

Learn Ruby and Rails

The pragmatic programmers wrote that we should learn at least one language a year. For the past couple of years I have been pretty lazy on this. I tried Ruby a little bit last year and I liked it, but I did not pushed enough. This year I want to really give Ruby a go. I want to use it to build a few breakable toys and then give Rails a try. Once I’ll start to feel good programming in Ruby with Rails, I should try to pick an open source project and start coding on a real Rail application.

Start Doing Continuous Integration

I have read a lot about continuous integration, but I have never gave it a try. This kind of practice is not encourage where I work. But this is not an excuse, anyway even at work it has begun to change.

I try to use TDD as much as I can, and I want to push on this more this year. I want to set up a Hudson server at home and explore all I can do with it. Automate the unit tests, learn to automate the deployment of the build, check the code coverage, validate that the coding standard are respected…

Read 20 Technical Books

This should be an easy one. I love to read and I am trying hard to learn new things and open my mind to new ideas. My Shelfari bookshelf already have 32 books I want to read. And every books I read has more recommendations. I add them to my list faster then I can read them.

Experiment With a NoSQL Database

For my storage solutions, I rely only on relational databases. Since I have not try any NoSQL solution if I come across a problem where it would be the best solution I probably won’t even think about it. I have read a little bit about CouchDB, but I need need to actually start playing with it or another NoSQL database.

Become a Zend Certified Engineer

I will keep my reasons for getting the Zend certification for another post, but I think it’s about time I do it. And I want to do it early this year. I aim at getting it for the end of February.

I have already begin my preparation. I started reading the PHP manual and I want to read the Zend PHP 5 Certification Study Guide from PHP Architect. I also installed the PhpRiot iPhone app and I want to do as many practice tests as possible. I am aware that most of this material is for the PHP 5 certification, but most of it is still relevant to the PHP 5.3 certification.

Learn To Use Vim Effectively

Vim is a tool I use daily. However, I use it like any other editor. I use the arrow key to navigate, I use the mouse, use only one buffer at the time… I know Vim can be way more powerful than this. So this year I will learn to use many more of it’s functionalities.

I already started with this. I found some Kata that I practice every day. I installed Vrapper to emulate Vim in Eclipse. And whenever I edit a file, I try to be aware of how I use Vim functionalities. I already see a difference in my editing, and some of this new knowledge of Vim commands is starting to make me more productive. The downside of this is that I’m beginning to miss Vim when I work in other editors, especially for navigation.

Learn The Basics Of Web Design

Web design is one of my greatest weakness. As a web developer I know the basics of css. If someone gives me a Photoshop of a web page to reproduce in html I will make it. I might struggle with some part, especially making it work in IE. But in the end the result should look like what I was asked to do.

But if someone ask me to design a web page it will be ugly. I’m a back developer, so the page will be functional. Everything should work as expected, but the result will be scary. For a long time I just blame this on a lack of artistic talent, but it’s not an excuse. I am working on web pages everyday. I should at least know the basic rules about fonts. I should be able to differentiate a good design from a bad one. Understand why a design is good.

Knowledge of the basics should help me avoid the common mistakes. It will not give me talent, but at least if I have to make a web page from scratch, it should at least be presentable.

This Will Be a Busy Year

I have given myself quite a few goals for this year, but I think I should be able to meet them all. I have to be careful though. Since I decided on those goals, I have a tendency to tackle them all immediately. If I do this, I set myself for a big failure. If I attack them one or two at the time I will get great results.

Hopefully, at the end of 2011, I will be a better developer than I am now by far. I am aware of my many weakness and I want to work hard on them. So next year I will give a shot at other weaknesses.

Tags: ,

Eric Hogue on January 5th, 2011

Welcome to my new blog. I intend on using this blog to write about various subjects that should be of interest for developers. I should blog about things I learn while developing at work or on my personal projects. I might also write about the life and career of a developer.

Why Am I Staring This Blog?

Last November I attended Day Camp For Developers hosted by Cal Evans. During the first 2 sessions, Lorna Jane and Elizabeth Naramore gave some pretty convincing talks about how good blogging his and how important it is.

On that day I decided it was about time I started my own blog. But work have been crazy for the last 3 months and with all the overtime I kept postponing it. With the new year, I decided that starting and maintaining a blog would be one of my top priorities. But again I was not doing anything about it. Then yesterday, I saw this post from Lorna Jone and I decided that if I waited after the rush, I was never going to do it. So here it is, I’m starting my blog.

I want to use it has a way to keep track of things I learn. Forcing myself to put what I know in writing should force me to push a little deeper and research more. Also, since it is public, I might get comments that will correct any mistakes I might makes or add more information on the subjects I will discuss. And if what I will write helps someone else, it even better.

It should also improve my writing even if English is not my primary language.

Where Do I Go From Here?
This is the hardest part. Now the I have the blog, I have to make sure I write on it. I already have a few ideas for future posts, but I have to be disciplined and take the time to write them. I also have to get in the habit of noting any idea I get so I can come back to it later and blog about it.