Archive

Posts Tagged ‘ORM’

ORM patterns which are ‘Invisible to the eye’

February 10th, 2010 Frank No comments

The more I work with design patterns*, the more I come to respect them as a design tool. For grad-school, I’m writing a DVCS and I needed some information on ORM patterns. While I’m not sure if this is a real term, I Googled it and found a great article on Invisible to the eye.

The article can be found at: http://giorgiosironi.blogspot.com/2009/08/10-orm-patterns-components-of-object.html

For my project, I’m mainly interested in the Data Mapper and the Table Data Gateway. Both are patterns from Martin Folwer’s book Patterns of Enterprise Application Architecture.

While I’ve not read the book yet, I think I might… After classes…. Anyway, I mostly wanted to share on the 10 ROM patterns listed at Invisible to the eye.

*If  you’d like a good intro to design patterns, I love Head First Design Patterns

Invisible to the eye

FireFox – Getting Source Code from Mercurial and 1st build

August 17th, 2009 Frank No comments

This is a follow up post to FireFox — Getting Started. Consider this more of a status post to show my progress in the previously linked post.

I’ve orientated myself on Mercurial a bit but I still have a lot to learn. I must state now that it is completely different from Subversion (SVN) and CVS. If you are new to systems like Mercurial — otherwise known as Distributed Source Control Management systems, I suggest you study up on them. The Mozilla team has put together a great starting out reference which is here and the Mercurial team has put together a great book here.

You can get information on getting the latest tip of “mozilla-central” from the following web page:

https://developer.mozilla.org/En/Developer_Guide/Source_Code/Mercurial

One tip I do want to leave here for others is that you should clone the mozilla-central repository twice. Once from the http site and once from the new local copy.

The first one, which I call clean, is a exact clone of the mozilla-central from Mozilla. I then clone this local repository and work in this new clone. I call this local clone working. With this setup, if you massively screw up your working directory, you can always re-clone your clean copy. I believe I read this in the Mercurial book.

My First Build

This series of blogs posts is actually suppose to be focused on the construction and (in some ways) development of FireFox. But, for me the first step to understanding a given project is to be able to compile or build it and run it. If you can’t build or run it, you can see what your hacking is doing to the results.

I’ve been able to successfully build the source code, however not on Windows as I had hoped. At least not yet. I’ve successfully built it on my Mac OS X machine.

Anyway, I continue with my quest to build on Windows as I suspect most of my research will be on my Windows Vista machine.

I’m not going to include how to build Firefox here. The Mozilla team has done a wonderful job documenting how to build on each environment and furthermore, they have set everything up to be newbie friendly.

My only advice at this point, is to go from top to bottom — don’t skip steps and install everything that they ask. Quite simply, if you skip around without knowing what you are skipping, your build won’t build and the error messages can’t tell you what you are missing. You end up reviewing the directions from top to bottom again.

Again, here are the Simple FireFox build instructions from Mozilla.

Categories: Random Tags: , ,

FireFox – Getting Started

July 28th, 2009 Frank No comments

This site was established with the my express desired to learn how  certain major open source software packages work; this was to be a personal endeavor to broaden my horizons.

As it turns out, I ended up enrolling in graduate school. I’m pursuing a Master of Science in Software Engineering — something I’ve been planing since my B.S. (which is as represented).

I lost my focus on this site but I don’t want to. I want to regain that focus and this is my first post to that end.

This post is the information I gather while setting up to review and understand how Mozilla’s FireFox works.

Getting Started with Firefox

A while back, before I had even started writing this post, I posted a question on StackoverFlow.com about how to learn about how FireFox works. I’ve received some great answers.

The answer I chose to accept was from jbinto; who gave a wonderful detailed answer and list of resources to pursue this. I’ll be utilizing these resources along with my own method of stumbling though the code.

I’ve started with the Windows Build Prerequisites page since I’ll be building on windows (vista). I imagine my greatest audience will be Windows users and hence I’ll stick with windows. But I do use Linux and Mac OS X too, so if you have a question about these environments, post a comment and I’ll try to address it.

I’ve downloaded and installed the package. It apparently includes everything you need to build FireFox — Including the Source Control Tool and diffing utilities and such.

I want to work on the latest tip; but apparently, the FireFox team uses Mercurial as their source control tool. I’ve never used this tool so this is good and bad. I can learn to tool but I  have to spend the scarce resource of time to do so. I’ll be taking a short deviation way from my current plan to learn the Mercurial basics.

I won’t be posting much on how to use Mercurial as there is plenty of documentation. Anyway, off to learn about Mercurial — I shall continue with this article series once I’ve obtained the tip of FireFox.

http://mercurial.selenic.com/wiki/

Windows 7 RC Available

May 6th, 2009 Frank No comments

Any one that would care probably knows already but the Windows 7 RC is available for Microsoft.

You can get more information at: http://msdn.microsoft.com/en-us/evalcenter/dd353271.aspx

Categories: Random Tags: , ,

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.