Wednesday, August 19, 2009

Unit Tests Are Not About Testing

See Unit Tests Are Not About Testing at its new home on bradley-holt.com.

I had the suspicion for a while but it didn't become clear to me until recently that unit testing really is not about testing. Sure, you are writing tests and there is certainly value in having "tests." However, the real value of unit testing becomes evident when you stop thinking of it in terms of testing. If it's not about testing then what is it about? Unit testing is really about defining behavior. Enter Behavior Driven Development (BDD):

It is not too surprising that it takes apprentice TDD [test-driven development] practitioners a while to realize that TDD is not about testing when all of the nomenclature surrounding it is described in terms of testing.

The aim of Behaviour Driven Development (BDD) is to address this shortcoming. By using terminology focused on the behavioural aspects of the system rather than testing, BDD attempts to help direct developers towards a focus on the real value to be found in TDD at its most successful.

If you're using PHPUnit then check out the Behaviour-Driven Development chapter for more details on how you can use this approach.

Monday, August 17, 2009

Models of Software Acceptance

See Models of Software Acceptance at its new home on bradley-holt.com.

A little while ago I read Richard P. Gabriel's talk on Models of Software Acceptance [PDF]. I couldn't find a date on this talk but I think it's rather old, at least in terms of technology. However, there is very little in there that seems dated and much of it is very relevant today. From the introduction:

Building business success on technology is not easy—myths abound based on common sense, tales told by those who have won, analogies to things like evolution, and appeals to inventiveness and innovation. When we look closely at how technology is accepted and how success is built on it, the picture is quite different, and the process of acceptance is both lengthy and unpredictable. In this talk we’ll look at the myths and the realities, we’ll look at many specific examples, and we’ll conjecture a set of principles that might work.

Those of us who use and build technology every day often don't give much thought to technology acceptance. We're always trying out the newest and latest technology and are frustrated that others aren't keeping up with our efforts to bring technology forward. We're often surprised by what technology does and does not get accepted by the mainstream. We wait impatiently for the rest of the world to catch up with us. A common meme on the popular technology news website Slashdot is, "Where's my flying car?" Most people don't want a flying car, at least not yet.

Many of the interesting innovation opportunities are in technology acceptance. Sure, Google has some of the most advanced technology around but how have they lost out to Facebook over Orkut and to Twitter over Jaiku? Both Orkut and Jaiku are owned by Google but Google's likely superior technology platform does not necessarily equate to superior user acceptance.

The information in Gabriel's talk is great news for startups and entrepreneurs. Focus on technology that is several years old, keep your design simple, and find a niche opportunity where a larger competitor can't beat you at gambler’s ruin. Read the full talk [PDF] for all the details.

Thursday, August 6, 2009

Social Coding

See Social Coding at its new home on bradley-holt.com.

My first real introduction to Git and GitHub was at last year's ZendCon. I've been using Subversion, a centralized revision control tool, for a few years now and it has changed the way I work. For example, I think in terms of changesets or "commits" that fix a defect, make an enhancement or complete a task in my codebase. It's a workflow that has served me well.

I'd heard about distributed revision control tools before last year's ZendCon. I thought it was a neat idea but didn't really get what the advantage was over a centralized tool like Subversion. The folks from GitHub had a vendor booth so I thought I'd ask them why Git was better than Subversion. I forget exactly what they said (probably something about how branching and merging is so much easier in Git) but whatever it was it definitely made me consider trying Git.

The GitHub folks were wearing t-shirts that said, "fork you" and explained that on GitHub they encourage projects to fork. Typically in free/open source projects forking is considered a bad thing. It usually signifies some breakdown in the community when one project forks from another. However, with Git and GitHub it's really easy to "clone" a project's repository, hack away at some changes, and then "push" (or have "pulled") your changes back to the repository you originally cloned. Git makes branching, cloning, pushing/pulling, and merging very easy and GitHub provides a place to host your repositories making this interaction with other people's repositories very simple.

GitHub's tagline is "social coding." With distributed revision control each developer gets his or her own project repository. If your repository is public then anyone can come along and make a clone of it giving themselves their own copy of your project to work on. Assuming their clone is also public, you can track their changes and decide if you want to pull in work they've done. If you find yourself collaborating a lot with a particular person that you trust, you can give them the ability to push to your repository. With Git this actually scales to projects with lots of contributors. This may seem chaotic, pushing and pulling changes to and from decentralized repositories, but it's actually a great way to encourage ad hoc collaboration.

If you want to learn more about Git you can read the Git Community Book, Pragmatic Version Control Using Git or the Pro Git Book. One last thing: if you're currently a Subversion user then forget everything you know about how Subversion works. While a lot of the commands may be similar to Subversion and there's a way to integrate with Subversion (git-svn), Git is fundamentally very different than Subversion. If you try and equate the two you'll most likely end up confused!

Wednesday, July 29, 2009

Free/Open Source and Proprietary Software Symbiosis

See Free/Open Source and Proprietary Software Symbiosis at its new home on bradley-holt.com.

Last week on The Browser I was talking (again) about free/open source software and open standards. Jonathan Butler (the host) asked what my thoughts were about my iPod touch which is proprietary hardware and software. Paraphrasing my answer, I said that Apple has created a killer product and a big part of this is their complete control over the platform. However, long-term innovation can only be sustained by free/open source software and open standards.

I was thinking about that question after the show when I remembered something: there's a ton of free/open source code in the iPhone and iPod touch. These devices run a version of OS X, parts of which come from the free/open source FreeBSD operating system. Safari, the device's web browser, uses the free/open source web browser engine WebKit. Contrary to popular belief, many free/open source software licenses allow you to make proprietary derivative works. Apple does contribute software back to the free/open source community even though they are not always legally required to.

My point is not to praise Apple's contributions. Likely these contributions are beneficial to them. If they branch a free/open source project and their branch strays too far from the original, they will have a hard time incorporating new features from these projects. Linus Torvalds (credited with developing the Linux kernel) recently commented on Microsoft's contribution of code to the Linux kernel:

I agree that it's driven by selfish reasons, but that's how all open source code gets written! We all "scratch our own itches". It's why I started Linux, it's why I started git, and it's why I am still involved. It's the reason for everybody to end up in open source, to some degree.

Apple and other proprietary software companies (maybe even Microsoft) are starting to demonstrate an interesting symbioses with free/open source software. While I do think that free/open source software is better for "consumers" and beneficial to society in general I don't think any of that is a necessary argument in support of free/open source software. I think that it is an approach that will ultimately create more value and be better at sustaining innovation than proprietary software. Smart software companies are starting to recognize this. Apple has reduced their upfront and ongoing research and development costs by tapping into free/open source software, even if the products they deliver to customers are proprietary. They also seem to understand the value of releasing some of their own software and modifications under free/open source licenses: they will get back more than they put in and the reward is greater than the risk.

Domain-Driven Design

See Domain-Driven Design at its new home on bradley-holt.com.

I am currently reading Eric Evans' Domain-Driven Design book. Having read most of the book I can say that his presentations on Putting the Model to Work and Strategic Design are an amazingly concise overview of the book's content (note that InfoQ provides slides below the videos). If you've been interested in reading the book but just haven't had time yet then I'd recommend watching these two presentations.

I have a lot of experience building web applications that separate business logic from presentation and have been using Zend Framework's model–view–controller (MVC) components for over two years now. This has certainly helped make web applications I work on more maintainable. However, creating effective models (the "M" in "MVC") has always been difficult (this has nothing to do with Zend Framework and has everything to do with the difficulty of modeling in general). The Zend Framework team has been relatively quiet on models since modeling tends to be specific to your application's domain (although Matthew Weier O'Phinney recently gave a great webcast and presentation on modeling in Zend Framework).

The Domain-Driven Design book has helped make a lot of things "click" for me. It drives home the point that modeling is a domain-specific task and that the complexity is usually in the domain, not the technical aspects of your project. If you think the complexity is in the technology then you should question your choice of tools (in my opinion) but in this case perhaps domain-driven design isn't right for you. The book provides many patterns that help keep the focus on the domain. Arguably the most important of these patterns is the Ubiquitous Language which is "a language structured around the domain model and used by all team members to connect all the activities of the team with the software." Other important patterns include Entities, Value Objects, Services, Repositories and Factories.

If effective modeling has been something that you've struggled with then I'd urge you to check out Eric Evans' presentations and then read his Domain-Driven Design book.

Thursday, July 16, 2009

Free ZendCon Pass

See Free ZendCon Pass at its new home on bradley-holt.com.

The Burlington, VT PHP Users Group has won a free pass to ZendCon '09 along with Austin PHP Meetup, the Chicago PHP User Group, PHPBenelux, and PHPWomen. Congratulations to my fellow PHP users group members! Now we need to pick a lucky member to get the free ZendCon pass. Are you a local PHP developer that meets the criteria? If so then send in your application by 8/1/2009.

Monday, July 13, 2009

New Media Office Hours (East)

See New Media Office Hours (East) at its new home on bradley-holt.com.

If you're a "new media" (social media, digital video/photography/editing, podcasting, etc.) enthusiast (or just curious) in Burlington, Vermont then you should check out the New Media Office Hours this evening. From the VCAM blog:

So we’d like to officially announce that the first New Media Office Hours (east-coast) gathering will be this coming Monday evening at The Sapa coffeehouse in downtown Burlington at 5:00 P.M. A small group of new-media pros and arm-chair enthusiasts will be on hand to chat with anyone who stops by about whatever is on their mind (related to new-media, that is).

I'm not sure yet if I'll be able to make but it sounds like a fun event!