Marty Andrews

artful code

Sunday, January 25, 2004

The grass is greener.

I just changed from using Greymatter to using Movable Type for my blog engine. Why? Mainly because my friend Jon raved about some features he was using that I didn't have. I'm looking forward to being able to edit blog entries offline and receiving trackback pings. If anyone bothers to read my stuff that is...

Do animated gif's suck?

A client I'm working for recently asked for some basic animation on a web page as an indication of activity. One of the developers on the team created an animated gif of a barber-pole for him. I groaned inwardly when I found out, but then went home to try it myself...I'm the first to admit that I'm not very good when it comes to creating graphics, and this was no exception. The resulting image is the anagram animation at the top of the page. To build it, I created each of the frames in powerpoint and saved the slide pack as a series of gif images. Then I imported each of them into a gif animation tool frame by frame and set the timing on each. I had to tweak the image size down quite a bit, and finally I crunched it to get the file size as small as I could.I like the result, but I'm not sure that I like putting it on my web-site. Does it suck? I'm reminded of an IBM ad that ran in Australia where developers argue about using a spinning logo or a flaming logo. The business representative suggests that they could instead actually build some functionality like automation of supply-chain ordering. Confusion kicks in quickly.What do you think? It's only on the blog section of my site so far. If popular demand agrees that its sucky, I'll move it off to a far corner where people interested in those things can find it.

Saturday, January 10, 2004

mock objects rock! Mock Objects suck!

Developers using Mock Objects aren't getting better designed code. They're following the trend of the community to use Mock Object projects without understanding the mock philosophy (sic). Using mock objects is a design technique, but Mock Objects only provide a testing technique. If people use mock objects instead of Mock Objects, their designs will improve.In case you haven't noticed yet, I think there's two things here that need to be considered separately - "Mock Objects" and "mock objects"."Mock Objects" (with capitals) are tools that try to automagically fake API's of 3rd party libraries which get used in Java programs. They are used as a *testing* technique. I think they are bad."mock objects" (without capitals) are just a way for developers to stub implementations of parts of their own code (not 3rd party libraries). Developers write the mocks themselves rather than having it generated. They are used as a *design* technique. I think they are good.The reason I like "mock objects" is that you use them in conjunction with TDD to drive the design of your code. The code getting mocked is at least one layer in from the 3rd party libraries, so you end up with better abstractions in your code and a much cleaner design.The reason I don't like "Mock Objects", is that you end up with complex mock behaviour (mainly because of complex 3rd party API's). It's also easy to get a bit lazy because your design is not being driven anymore.