What started out small has grown into an ugly tangled monster. As with many people’s github accounts, mine only had a few things in it at first and all was well. But as more code was written the repository began to smell and was in need of some splitting up. So that is what has been done.
I spend a lot of time in various IRC channels answering questions and helping out, and one recurring theme that pops up again and again is people not knowing what to do when things go wrong. Whether it be a simple error or a logical mixup, people often lack the tools or processes to figure things out. So I thought I would share how I approach errors and problems.
In the ongoing struggle against code bloat and creative ways to do things, I’ve been playing with throwing exceptions from model methods. While not earth shattering stuff, I’ve found it to have a few advantages over returning false. First, you can end up with less if and else statements.
Re-factoring code is a part of any programmers life or should be. Very few people write beautifully clean and well factored code from the start, and I am certainly not one of them. Most times my code starts out a sprawling tangle that takes an additional pass or two to look like something I would consider clean. I find that when programming and designing I start with a rough idea or sketch of what I want to accomplish.
Today marks the 1.1 release of DebugKit. After using it for the past few weeks and not finding any new issues or getting and new tickets. A few new features snuck into the release, courtesy of Andy Dawson.
Today is the one year anniversary of my first commit to CakePHP, amazing how time flies. It seems not too long ago that gwoo and nate approached me to join the core team and help with writing the tests for 1.2. What started with test cases soon bloomed into full blown commit access and had me working on all parts of the core. Year one also saw the creation of DebugKit which is nearing its 1.
Generating code coverage for test cases is a handy feature, it gives you a quick and easy way to determine how much of your code is running during your tests. It doesn’t ensure that the tests are good or that you have enough assertions, but code that doesn’t run definitely has not been tested. Before code coverage was created it was very difficult to determine how much code was being run.
So I’ve been working away on DebugKit the last few weeks. And I think its at a level where I can suggest other people give it a whirl. Its not at a stable release point. But if you are feeling adventurous and don’t mind using beta code give it a try. There are a few notable features have been added, so in no particular order here they are.
vCards are a nice added touch for an application that acts as a Address book, or contact management. vCards are easily used by most mail clients, and are a plain text standard making them nice and easy to implement. While hCard and other microformats are gaining popularity, the widespread support still doesn’t exist. Leaving vCard as the primary format to transfer contact information out of a web application
As most people know TextMate is a pretty amazing text editor, probably one of the best for MacOS. What you may not know is that CakePHP has its own textmate bundle. this bundle is maintained by JoÃ«l Perras who is also a recent addition to the CakePHP core team.
The release of the new API at http://api.cakephp.org wasn’t quite as smooth as I would have liked it. However, since the initial release things have constantly been improving. The search is now much more effective, and global functions are now in the index. So things are looking better each day. I hope to answer a few questions surrounding ApiGenerator today.
Well its been a while coming but today, DebugKit officially left GitHub. As noted in the past by some, the CakePHP family of projects were a bit scattered. So in an effort to consolidate everything, DebugKit has moved over to thechaw alongside other fabulous CakePHP projects like CakeBook and ApiGenerator.
If you’ve been to the http://api.cakephp.org today you may have noticed a few changes. First its no longer powered by doxygen. Doxygen has been giving us a few headaches in the last few months. So gwoo and myself have taken it upon ourselves to write our own Api generation tool. We called it ApiGenerator you can see it running at api.cakephp.org.
I recently wrote an article about testing CakePHP controllers the hard way where I covered testing controllers by running their methods manually. I hinted at some additional tricks that could be performed by using Mock Objects. Today I’m going to spill the beans on Mocks, and how I use them when testing my Controllers.
I’ve recently been doing some work on some CLI tools, and I came across the need to “paginate” a long list of file. Instead of dumping out 40+ items to the screen all at once, which would be confusing and hard to read, I wanted a more elegant way of showing only a section on the huge list at once.