Archive for the 'Programming' Category

What makes a good component/service?

Wednesday, October 1st, 2008

A few collected thoughts & notes from around the web regarding what makes a good component/service.

  • Interface - all implementations share this. Should have few methods, use data objects as return values, take primitives as inputs, throw only custom exceptions, and be very, very well documented.
  • Implementations - implement the logic behind the service. May provide extra features such as caching, or such things as optional collaborations.
  • Data - data objects this service deals with. Should be immutable, comparable, cloneable as much as is possible. Should be serializable/XML/Persistance annotated in most languages.
  • Storage - Data (or data.io) package should define storage API, and an in-memory data store. Allow other services/projects/subprojects to define database backed or other kinds of data stores.
  • Cache - Data.Cache packages should define cache API? (or can this be standard per runtime?) Who should be in charge of caching? The service itself, or the user of the service?
  • Use dependency injection for all services/data stores it requires. Use constructor-injection as much as possible.
  • Throw errors early - in constructor if possible.
  • Exceptions - custom exceptions for high level categories of erroneous behavior (try not to do one for every possible condition - classify, and wrap). Don’t re-throw exceptions from other frameworks - wrap in custom exception.
  • Make behavior configurable via dep injection as much as possible. Use filters or strategies.
  • Inject 1 configuration object instead of many options. Standardize on configuration API/Framework for each runtime/language.
  • Standardize on logging framework/API for each runtime/language, and make sure it’s used (instead of System.out or simliar)
  • Provide events/messages and/or hooks for important happenings so others can do things pre/post.

iPhone development thoughts

Friday, June 6th, 2008

I’ve recently finished the functionality of my first native iPhone application. Here are some thoughts:

  • Apple makes it easy to “do the right thing” as far as the UIKit libraries go, pretty nice, and cleaner & easier than Swing or .NET in many ways. Very humanistic.
  • Unless I’m missing something, common tasks like field validation don’t seem to be built-in, that’s a hassle…
  • No SOAP libraries yet either.
  • Interface Builder isn’t quite there yet - many components still missing, so unless you’re doing a pretty simple UI, better code it by hand (which isn’t really that bad…)
  • I’m not a huge fan of XCode - the code completion is very weak compared to eclipse, as is the display of errors/warnings - many more clicks/research needed to diagnose what’s going on.
  • Managing your own memory sucks…
  • Since I’m coding the UI by hand, lining things up pixel perfect is quite a hassle. I’d be nice if they had the concept of a layout manager, like Swing/AWT, laying out components in a grid is not intuative (many examples I’ve seen use UITableView and a whole mess of ugly switch statements - very inconvenient & hard to maintain.)

Read on for more about the app…

Read the rest of this entry »

Presenting at mn.swf camp 2008

Sunday, April 6th, 2008

I’ll be presenting development best practices in the Flex/Flash/AIR tomorrow at mn.swf camp. Check back on this post for a copy of the presentation after I’m done.

Here is my presentation.

Learn objective-c/Cocoa (Mac OSX) development on the PC…

Tuesday, April 1st, 2008

So, I got interested in developing an application for the iPhone, but I don’t have a decent Mac to develop on. I found that the iPhone development is based on a subset of the Mac Cocoa framework. OSX came from NeXTStep. Cocoa is mostly NeXTStep libraries… hummm… how can I learn Objective-C/Cocoa on a PC… let me think… Read the rest of this entry »

First thoughts on Microsoft Silverlight

Saturday, July 28th, 2007
  1. Cool that it can work with plain JS and XML
  2. Fast rendering engine
  3. Cross platform/browser
  4. MediaElement events not great - may be due to the beta version.

I’m currently working on a very simple video player in SilverLight that will be controlled via JavaScript.

Object Oriented Programming

Monday, March 20th, 2006

One of the most important concepts you can learn is Object Oriented programming. Once OOP is mastered, learning any object style language becomes much simpler. Common OOP languages used on the web: Java, C#, as well as scripting languages such as JavaScript, and ActionScript.

Check out this wikipedia article for a general overview of OOP and many links out to OOP theory, and even a few links about what’s BAD about OOP.