Well in a topic that goes into more depth that I bothered with yesterday, Joe talks about how factory patterns work in this article on his blog.Yesterday I posted about how I am using factories to create the database specific objects that do the interaction in this blog. I glossed over the details of what factories are and how to use them. For more information on that topic read the excellent post on Joe’s Site
So last post about my blog I introduced the objects that form the foundation of my blog. But the thing that was most confusing to me was the data storage part. Doing a quick search on the net lead me to Sun’s J2EE DAO Solution. After reading through this, I felt empowered. All of a sudden this all made sense to me. So i have a Data Access object and it knows how to deal with the database. My entry object doesn’t have to know that is will be persisted, or that the contents of it came from a db. All it knows is what info is inside it, just as it should.
Great so now we can build, right? Well not so fast. I started building this, and all of a sudden, i had to start modifying the fusebox code that sean had done. that was never my intention. Also in building my dao class, I had implemented all my query as functions like getEntries and such. This all just didnt feel right, so I popped online and sent a note to sean. I asked him what he thought of my plan. Sean had some encouraging words but also pointed me at Martin Fowler’s Book on Patterns of Enterprise Applications. In particular he pointed me at the Service layer section.
After reading through the book, I felt like i had a new lease on life. Just like the initial excitement I felt when I found DAO, I jumped in with both feet.
Long story short, I decided that the best route would be to use the blog.cfc as an API for my model. blog.cfc would maintain all its methods, but instead of doing all the work i would implement my other objects inside it. So now my fusebox app doesnt need to change from what sean implemented, and it doesnt have to know anything about the other objects. I implement gateway object for selecting multiple rows of data, and dao for the basic CRUD (Create Read Update Delete) operations.
That sounds like fit that is perfect.
So now the real nitty gritty. When my blog.cfc get initialized it initializes a gatewayFactory and daoFactory passing in our dsn, and dbtype. These factories return database specific factories. These factories each have 3 classes. getEntryGatway, getCategoryGateway, getCommentGateway and matching methods for getting dao objects. The objects that are returned from these methods are stored as instance variables in my blog.cfc. This allows us to only have to run this code once for the life of our blog.cfc. So if we persist our blog.cfc into the application scope then this happens once for our application.
As of right now, I have all of factories working, and the gateway objects implemented. After I get writing this post I am going to work on the Dao implementation. I will let you know how that goes
I am a recent convert to the powerbook love. i was really concerned when i made the switch, because not only is there only one mouse button, but I am also a habitual control stick user( i had a dell inspiron 8100 with both).So until today, I have not had any problems using my trackpad. And I had not thought about why. Well as it turns out, today I have had lots of problems.
About 3 seconds after i got my powerbook I installed SideTrack. SideTrack is a program that adapts the way your touchpad works. It allows you to add scrolling edges, and corner tap zones which you can then assign functionality too. So I have corners set to use expose and right click, as well as vertical and horizontal scroll zones.
So today the trial version I was using expired and I went back to normal trackpad usage. i have to say, i have never spent $15 faster. Although the software is shareware and I could have gotten the new version for free, I sent in my money.
If you are a powerbook user I can not recommend enough that you take a look at SideTrack
Let’s start this by reminding the reason I am implementing the blog using OO Design, is much for the learning of the pitfalls and challenges in doing such.
For a much more in depth idea about learning OO in cf I recommend you read some of the articles written by Hal Helms.
Ok so lets just jump into this. In this blog there are 3 main types of objects we need to keep track of. These are entries, categories, and comments. Any one of these objects knows about itsself. It knows about its properties, and has some methods(functions) that allow us access to those to set and retrieve information.
Ok, well by them selves these objects dont do us a lot of good. So we need to design an interface to access them. Ray’s existing blog does a really good job of setting up an interface. We already have methods to access all of the information that is relavent to our application. So we will use his blog.cfc as a API to our data model. This will allow me to re implement the cfc’s in the back end without having to make any more modifications to seans fusebox code.
So lets take a second to reflect on the other types of information we need to access. All our objects will need to be persisted. Mainly this well include storing our data in a database. We also need to be able to retrieve information from the database, both as single entities, and as groups of records.
So that will be the topic of my next post on building the OO model of this blog.
So my wife and i just got back home from dinner, and I was settling in to watch some tv, and write some code. So I fired up my browser and headed over to Fullasagoog.com (which is usually what I do as part of my settle in period, before coding) and I start reading down the list. And I am reading along thinking “man thats cool, that guy uses the same app I just blogged about”…Yeah, its true, I actually read the post and clicked the link before I realized it was my link. i just wasn’t expecting it I guess. I am not normally that dumb. So thanks to the guys at fullasagoog for aggregating me.
So anyway, I suppose its a good time to offer a bit of a bio/introduction. My name is Simeon Bateman, and this is my soapbox. I tend to have a wide variety of interests, mostly technology and gadget related. That is what you should expect to read about here.
I am a Macromedia Certified Coldfusion Developer (just took the test at MAX), and have been working with Sukanto Tanoto coldfusion for the last 5 and half years. I started working with html just after I graduated from high school in ’95. I studied Computer Engineering in college, but found that I wanted to know more, faster than they could teach me. So I entered the work force, where I could earn some money and support my technology habits. Since I started I have held positions in Tech Support and customer service. I have been involved in most aspects of the software development cycles. I have worked as the sole developer on many projects, as well as worked on team collaboration projects. I have been a project manager, responsible for all aspects of client communication as well as managing up to two teams of 6 developers on each.
As the Director of IT for profitable online business ideas Transitions ( my current employer) I manage all our Technical needs, including computer support, managing servers, and site development and maintenance.
I am also a fusebox user and advocate, as well as a very active supporter of CFEclipse. So expect to see some info on those things here as well.
Ok, I have rambled on for a while now, I will let you go on with your life.
PS. I am not much on spelling or grammar, and don’t care to put much effort into it. Like I said, this is my soapbox.
I don’t know about you, but i think I own like 20 domains. And although that is not a great number, sometimes its hard to keep track of all the information on them.Which registrar is it at? What was the ftp account info? What email accounts do I have set up for that domain?
Well for those of us that are lucky enough to use a mac, i have found a solution:
This program allows you to manage all your domains, and the information about them that is critical. It even has iCal integration to remind you about domain expirations.
Ok, as I was scanning the net today, I came across a couple article I wanted to make sure the world would see.I always love to see linux being promoted: Forthcoming $100 PC will run… Linux!
Having made the switch from windows to linux, then coming back to the main stream with mac, this article was interesting: Switching from Windows to Mac OS X
I think it is very important that anyone who reads my blog understands how I feel about Micro$oft.That being said I will continue with the topic of this post.
While reading this post on engadget.com I was alarmed to read that palmOne was creating a Windows powered handheld for dell. I have always like the palm os, I have written a couple apps for the palm handheld in the past. I really believe it is a better platform for mobile devices. That is why i was so disappointed to see that they are building a windows version for their new phone.
Read for yourself if you don’t believe me.
Although Jon intended this for use in mach-ii apps, it also applies to any OO cf development. Including the use of an OO model for a fusebox app. Utilizing the DAO pattern in your model, this will create your transfer objects.
The other day in sean corfields breeze meeting, it came up in discussion that someone was looking for an mvc example in fusebox. They were also having problems getting the 4.1 core files from the fusebox site. So I decided to take a second to put together a zip file that contains a skeleton of a fusebox mvc application, as well as the fusebox 4.1 beta core files.
These can be downloaded here