I figured having some unit tests for Maps, the MediaWiki extension to work with geographical data and display it by embedding dynamic maps into your articles, would be beneficial to it’s quality. It’s pretty hard to try cover all possible use cases with manual tests, and consumes a lot of time in any case. I therefore decided to try create some tests for the coordinate parser and formatter class, as it’s arguably the core feature of Maps.
I started off by trying to install plain PHPUnit, which is the most commonly used unit testing framework for PHP. This took me a while, as you are supposed to install it using PEAR (PHP Extension and Application Repository), a repository tool for PHP applications, and has never used this before. After two hours or so of messing around, I got both installed
Then I went on investigating how I could best integrate this into my work-flow, and discovered that PHPUnit comes bundled with Zend Studio, seamlessly integrated, working completely out of the box o_O.
I then wrote a test case for the coordinate parsing and formatting class of Maps. I had a hard time getting it to work, as I needed to include MW itself, as the class uses MW functions. After some non-constructive discussion with several fellow MW devs I found a way to get it to work by including the maintenance script entry point, and tricking MW into thinking the call was made from a CLI. I now have a test case for the coordinate class, with tests for most of it’s functionality. Some more test data, and maybe some extra tests would be nice. A tricky thing in the case of this class is founding errors, which are hard to take into account, especially if you only want to allow them to a certain degree.
This particular test case is already paying off, as it made me find 3 subtle errors in coordinate parsing or formatting, that did not show up in my manual tests, as I was not covering the test data causing the issues.
I’m now planning to maybe write test cases for the distance parser to, which should be rather easy to do. I probably won’t create any others for Maps, as it’s rather time consuming, and I have a lot of other things to do right now. When I create new classes that are suited for unit tests in the future, I’ll definitely write tests for them as I build them up though, as it’ll not cost a lot more time then doing manual tests, and will ensure the classes are really solid.
About a year back I decided I had to change my development environment from working on a remote server with a simple text editor to something more solid, if I wanted to do serious PHP development.
I went for Eclipse as IDE, which is without a doubt the most awesome IDE out there, as it’s completely open source, robust, and has a lot of extensions that make it usable for an awful lot of languages. For PHP there is the open source PHP Development Tools Project, and the commercial Eclipse based IDE build on top of this, Zend Studio. At that point having my development environment as mobile as possible was rather important, as I often occupied machines other then my laptop or my own desktop. Therefore I put both Eclipse and my server on an usb.
Now, a year later, a lot has changed, and I finally updated my tools accordingly. First of all, I’m now also using Linux, and plan to leave Windows into the dust bin soon, so prefer tools that work on both operating systems. Secondly, I now only develop on my laptop and own desktop machine, so portability is not as important any more. Also, I’m now doing a lot more serious PHP development as I was doing a year ago, and would benefit a lot from more decent debugging, testing and profiling tools.
What I did was throwing out my mobile web server and install Zend Studio, together with Zend Server Community Edition (which is free). They integrate in such a way that you can do code tracing, work with breakpoints, profile code, ect, all out of the box. If you are developing PHP applications like me and in search for a good tool, I can definitely recommend this. Zend Studio isn’t free, but it’s worth the price. Not going into a complete list of awesome stuff PDT and Zend Studio include, but this blog post, although a little dates, does a good job at it.
It’ll take me a while to integrate these features into my work-flow, as I’m not used to having them available, but I expect this to start paying off rather soon then late
Also waiting on a new release of Zend Studio build on Eclipse 3.6 (Helios).
(O yeah, can’t write a post about Eclipse without saying: NetBeans fails
)
Now the Google Summer of Code coding period has finished, I can divide my attention between multiple projects again. Since I’ve been doing PHP and JavaScript only for over 2 months now, I’m starting off with taking a PHP-break. This means I won’t do any development of mayor new features for Maps or Semantic Maps, and definitely won’t work on any other PHP project. Of course I’ll still ensure bugs get fixed for my mapping extensions, and help people out with code when needed, but that’s about it. So basically I’m closing my Zend Studio, which has become one of my most used applications in the last months, and starting my Visual Studio again. Now I think of it, this is really awkward. I used to start my VS practically every time I booted my computer for over a year, and then only opened it a handful of times in a 2 month period.
So, what am I going to work on now? One of my last projects before I started GSoC was a VB.Net background file downloader, of which I released an article on The Code Project, and later on created a C# version. I got quite some positive feedback on this project by people, although it was initially created with the sole purpose of helping that needed a simple downloader someone out, to improve my own skills, and to demonstrate how to create a simple to implement downloader. I’m now continuing this project, by rewriting it from scratch, to both add some mayor new features, and mess around with some multi-threading stuff I’ve been wanting to try out for months now.
The mayor new features that will be added are simultaneous downloads (the current classes only support one download at a time), segmented downloads (woot!), download priorities and bandwidth limitation options. This will require a nice OOP approach, with some more advanced multi-threading. I’m basing part of my code on MyDownloader, an extremely nice C# downloader, which has quite some more functionality then what I’m doing. It’s more extensive then required for most people though, and not all that easy to implement. I also don’t really agree with some naming choices, and it lacks both code docs for devs that want to modify it, and devs that want to implement it. So clearly, I’ll put a lot of effort in keeping the new project as small and to-the-point as possible, and pay attention to easy of implementation, and usability. Another obvious difference is that this project is in VB.Net and not C#.Net. This has more advantages then disadvantages IMHO. If the project is compiled to a .dll or is used in a multi-project solution, it simply doesn’t matter what language it uses. A lot of casual programmers don’t know how to handle either, and the majority of these uses VB.Net, and not C#. And the ones that do know C# are more likely to know VB.Net then the other way around.
I’ve created a project on SourceForge to host the code, and be able to commit to the project’s SVN. Since the project now contains multiple classes, I renamed it to .Net DownloadLib.
After that project I’m planing to put some real effort into my mapping extension for MediaWiki again, and possibly to have a look at Python and Ruby. When school starts again, somewhere half way through September, some new project opportunities will probably arise for me, but I guess I’ll see that then. I’m also looking forward to ‘learning to program’ at school, which is destined to give me some great laughs. Luckily for me I’ll have to learn C++ at university, so I won’t be totally bored with it. I hope they don’t drive the low-level aspects of the language to far, since that’s pretty useless in today’s world IMHO.
Zend Studio 7.0 is the next generation of our professional-grade PHP application development environment. It has been designed to maximize developer productivity by enabling you to develop and maintain code faster, solve application problems quickly and improve team collaboration. – zend.com
I just noticed, the new Zend Studio, 7.0, has been released 2 days ago! This is great new for me, since ZS is my primary IDE for PHP development. This release uses the latest Eclipse Platform (Galileo), offers better SVN integration and supports PHP 5.3, as well as a whole variety of other awesome features.
While working on Maps and Semantic Maps, I needed to refactor some class names, and tried to use the refactor tool of Zend Studio, the PHP IDE of my choice. The only thing that happened was an error popping up though. After some searching on the web and posting that problem on multiple help forum’s, someone suggested that I should install the latest version of Zend. At that moment I was using Zend Studio version 6.0. After looking at the wiki page about Zend Studio, I decided to download the latest release, 6.1.2, and installed it. I then replaced my old ZS with it, and switched to my GSoC workspace. This went really smooth, I didn’t encounter a single error, and apparently fixed the refactoring problem. Now I also have a bunch of new features available to me that came with this new version. Zend studio 7 is in the making, presumably based on the new Eclipse 3.5, and will undoubtedly contain a whole variety of new features to speed up the development process. One more tool to wait for…

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 