Monday, November 26, 2007

Is the DB the chicken or the egg?

There have been a few discussions recently about whether it is better to design your new application by starting with the model or the database. Arguments about starting with requirements aside, it seems like the prevailing thought is that you should start with the model. I'm sure that this position seems like the logical approach to many programmers because of all the attention object oriented (like) programming is getting in the ColdFusion community.

I believe this to be a bit of a spurious argument. If you think about it, the model and the logical design of the db are two sides of the same coin. They both share the same primary responsibility of providing a programmatic representation of real world objects/entities. While the two are not perfectly aligned in implementation, they are extremely similar when looked at logically. Even our tools for representing them are so close as to be nearly indistinguishable to the lay person. Try putting a UML Class diagram and ER Diagram in front of a non programmer and see if they get any additional information out of one type of diagram or the other. The UML even uses a stereotyped class diagram as a tool to do database modeling (although it's not an official diagram type). We even have object-relational mapping tools to bridge the two.

I've heard the argument that the best one to start with depends on the project being undertaken. I would take this a bit farther and say that it's not so much the project being undertaken as the developer doing the design that should influence which one you start with. It all depends on your view of what these two things represent. If you think of your object model as the true arbiter of your business rules and the db is merely a persistence mechanism, then you probably should base your design on the model first. It's where you feel most comfortable translating your requirements into code. Building the db is something that you just have to do in order to persist your objects. It's grunt work.

If on the other hand, you think of the database as the primary store and final authority on your business rules and that the model is simply a communication mechanism (albeit a very robust one) necessary to support your view and controller layers, then starting from the db is probably a better approach for you.

Personally, I like to start with the db, only because to me, it feels like the "deepest" part of the application. I tend to think of the db as the foundation of an application. It seems more difficult to fix design flaws in the db than it does in the object model. It also feels like the db is slightly better at modeling real world entities simply by virtue of its persistence. Real world objects don't wink out of existence by falling out of scope, but that could be a discussion better had by philosophers.

That's my $0.02.

p.s.: Regarding the chicken and the egg question. I think that the chicken would have to have come first. My reasoning for that is that we define the type of egg by the animal that produced it. For example, if we have a hen's egg and a chuck-stritch comes out, it was and always will be a hen's egg. We couldn't have referred to it as a chuck-stritch egg since we didn't know what a chuck-stritch was until it hatched. If the chuck-stritch grows up and lays an egg, we'll always know that it is a chuck-stritch egg.

Wednesday, November 21, 2007

flex 3 Beta and FF3 Beta flakieness

After installing the Firefox beta, it seems like it picks up your existing flash player install if you had it set up with Firefox 2. All is not well, though. There must be a few files or settings that don't migrate perfectly.

I didn't notice it at first because the debug output for me was still working. It wasn't until I started working with some rollOver effects that things seemed strange. The rollover event wouldn't fire on a component unless I first clicked it.

Not to worry. If you've installed the flex 3 beta, you should have a player distribution included in your Adobe Flex Builder 3 Plug-in directory (I'm not sure where it is in the standalone install, but it's probably similar). In there, on my mac, there is a player directory, a mac directory and a few flash Player install files. I simply launched the "Install Flash Player 9 UB.dmg" file, ran through the process and tried again. Everything seems back to normal now.

Great idea for the security bound.

I know of an organization that has strict security requirements for its network and employees that has implemented a nice tool.

As we all know, if we work for a company and use their equipment, we are generally not allowed to have any expectation of privacy. IM is blocked, websites are blocked, email is blocked, cell phones disrupted, etc.

For many of us that are technically and socially accustomed to being able to contact who we want, when we want, this arrangement can really chafe. So much so that I've know good talent to look for jobs where an open information policy is a major consideration when deciding where to work.

One forward thinking organization that I know of has realized this and tried to provide at least a partial solution. While they can't open up their network because of the sensitive nature of the work they do, they put together a small network that is off their grid in a common area. They have a number of cycled out computers in their cafeteria that are not connected to the organization's network that anybody can use. They also have a wireless hotspot there (which is great for my iPhone) that the company does not monitor.

Employees can check their external email, surf the web and generally use their lunch period as their own without management snooping through the logs afterwords. Generic logins are used by everybody and are publicly posted which helps to make the idea of monitoring those machines less attractive.

What a good idea. Kudos.

Tuesday, November 20, 2007

Firefox 3 plugs over 300 memory leaks

I've been using the new Firefox beta for a whole day now and not one crash or lockup. Of course I don't have my extensions installed now either, which I suspect is usually the culprit for most problems, although the occasional mishandled piece of html seemed to be a problem every once in a while.

I like the more mac-like skin (especially in forms) in the mac version. It seesm pretty zippy, too.

The Mozilla Blog

OT: Best Political Ad Ever

Sorry for having two political posts in a row, but this just cracks me up. That has to be about the best endorsement a candidate could hope to get.

Wednesday, November 14, 2007

OT:21% In Iowa!

Fred Who? Mike Huckabee IS electable

For the hordes of Republican ColdFusion and Flex developers out there, it's nice to see someone like Mike Huckabee doing well. We know what it's like to have the best solutions to our problems and yet often remain the underdog technology/candidate. Fred Thompson seemed promising before he got in the race, but he always reminds me of Dan Akroyd as the judge in "Nothing but Trouble".

read more | digg story

Thursday, November 08, 2007

onMissingMethod clarification

I few days ago, I posted a question regarding the use of the new "onMissingMethod" capability in cf8. I was trying to put together a simple bean and utilize the onMissingMethod to create all purpose getters and setters (in my case the setters are really three methods, 2 of which I wanted to use the onMissingMethod to handle). I had a problem in that onMissingMethod would not fire if I called another method in the same component. A basic example would be calling the setter from inside the init() method in order to exercise my business rules when the object is created. Since the method didn't exist, cf would throw an error.

Thanks to Sean Corfields comment about using the "this" scope for the internal method calls, I was able to get it to work the way I wanted. While I think my particular implementation adds a bit of overhead (not due to the onMissingMethod use), I don't think it will have a huge impact, so I willing to give it a shot until it proves to be a problem.

My code is a little rough at the moment, but when I get it cleaned up a bit, I'll post a sample and probably add a template or two to cfcBlaster.

Monday, November 05, 2007

onMIssingMethod question

I've just started experimenting with the onMissingMethod capability in cf8. It looks like the function only fires when missing methods are fired from outside the component. If you attempt to call a missing method from inside, you get a message stating that your method is undefined as a variable.

This is unfortunate because it precludes me from using it as a way to replace my getter/setter functions since I use them to enforce my business rules in a roundabout way. My setters get called in my init() method to set up the object's properties. Doing this instead of just setting the property value lets me enforce any constraints on my data on the way in to the object. It looks like I can't actually use the onMissingMethod capability for a missing setter. Is this true? Is there a workaround?