Archive

Archive for April, 2009

Book Review: Beginning iPhone Development

April 24th, 2009 Frank No comments

I’ve been wanting to learn how to develop iPhone applications for a while… Basically since the platform hit the streets. I found out the hard way that you need a Intel based Mac OS X computer to do so.

That left me out in the cold because I didn’t want to buy a Mac Computer just to do this, but I did. I bought a MacBook because I wanted a laptop. On a side note, I love the computer. The hardware is much better than Dell (whose been sliding on the quality of their hardware) and furthermore, Mac OS X is very, very elegant.

Anyway, I dived in to the iPhone SDK with the hopes of getting my first program out the door quickly. While I was able to get programs together and working, the platform is very, very different. To top it all off, the programming language is Objective-C which is quite different from any other language I’ve used.

Beginning iPhone Development: Exploring the iPhone SDK

Beginning iPhone Development: Exploring the iPhone SDK

I was up to the challenge but I needed help, so I recruited a book. The book is: Beginning iPhone Development: Exploring the iPhone SDK by Dave Mark and Jeff LaMarche.

The book was wonderful; I read it cover to cover in about 1 month. There are a few typos but I’m sure they’ll be corrected in a revision release, I’m sure. It is easy to read and easy to follow. I feel I understand everything the book was trying to tell us about. The authors go in to each topic enough for you to understand what they are talking about but they never go so far that they “lose you”.

A wonderful aspect is that their is an active forum to answer questions specifically about your work or learning in the book. Since others have gone though the capture, other readers can normally hep. Though, if all else fails, the authors will help you.

This book won’t make you a master iPhone developer, but it lays a very solid foundation in which to build your skills upon.

Overall, I highly recommend this book for anyone who wants to learn about developing iPhone or iPod touch applications.

Object Relational Mapping > A ‘Design Pattern’ Solution

April 23rd, 2009 Frank No comments

There has been a lot written about Object Relational Mapping — or ORM but I came up with a design that I intend to apply to my own projects and wanted to publish and share the idea.

This idea was my own; when I wrote this I hadn’t seen this idea published elsewhere. However, the idea is derived from a set of very common design patterns. It would not surprise me in the least if another designer/developer already implemented a similar idea. However, I digress…

Preliminary Information

The ORM is a method to take data stored in a relational database-type structure and represent the same data as object orientated classes.

I feel that the ten thousand foot level the idea is straight-forward. Assume that we are using the MVC (Model-View-Controller) design pattern for your application. Furthermore, lets assume that we’ve got a simple object to which will represent our Model (part of the MVC).

Lets assume our model object is the following:

Data Model Example

Data Model Example

The idea is to take a mix of the strategy and the decorator pattern. The strategy pattern is a design pattern that allows you to define the interface for an algorithm which can be different depending on the implementation.

The idea of the decorator pattern is to simply add responsibility to a class (through inheritance). My ORM is a combination of the two patterns.

The Design – a Class Diagram

The pattern is simple.

Diagram with OR Design

Diagram with OR Design

We use the interface to represent the ability to write out or read in with the Encoder. You’d implement the interface on to a derived class of the target class.

Why do we implement this interface on a derived class? Strictly speaking, we don’t have to. Though, this is intentional and part of the pattern that I’m trying to describe. This is the part of the strategy pattern working for us. This would allow us to implement different encoders for different types of storage mediums.

This means that we could create a set for SQL server, XML and perhaps a web service if so inclined.

Usage

The usage, I imagine, to be simple. Setup your basic interface and then derive a target class and apply the interface. Implement your interface to write the object and read the object to/from your storage medium.

One point of doing this, is that if a model object contains a collection  or an instances of another model object, you can use this interface to write and retrieve that object.

An Example

In all honesty, I had hoped to put together a simple but working example of this. I’ve not had the time and I’ve been sitting on this post for a while. I wanted to get this post out. I still hope to get together a simple example but for the time being the description is all I’m posting.

If you have specific interest in an actual implemention of my concept here, please leave a message below. The interest will help modivate me to take the time to get something together.