Tuesday, January 31, 2006

 
Clock Time Regex

My own work:

^(0[0-9]|\d|1[0-2]):([0-5]\d)\s+(am|pm)$

This verifies if the time you put in matches the 12 hour clock. It works in every flavor of Regex, from the Perl/LAMP engine to the Java version to the Javascript version.

Below is a 24 hour version:

^([0-1]\d|\d|2[0-4]):([0-5]\d)$

If I get any comments to this blog, I'll add a seconds verifier.

Monday, January 30, 2006

 
What does deprecated mean?

Down here in Code Monkey land we see our languages of choice change over time. ColdFusion's classic example is the paramexists() function, which was replaced by the much better isDefined() function and CFPARAM tag. In essence, both of these things ably replace the clumsy paramexists() function, giving the developer more flexibility, and hence more power. The paramexists() function has been deprecated since 1999, and you simply can't rely on it to work anymore in our heady modern days of 2006.

And yet, people still use it and other deprecated operations. Partly I think because of inertia and partly because they never bother to check the deprecated function/tag/object list in their language of choice. In fact, the word deprecated is like the word 'obsolete'. People see it and use it anyway in our field.

The gist of all this is that today this bit me. My baby application has another connection hitting it. Way back in October I listed two searchable fields as being deprecated. I warned the developer responsible and everyone around him not to use these fields. And they were used anyway. And now the ship is about to break apart on the reef of life thanks to someone ignoring my documentation and direction.

Days like this make me wonder about the state of my chosen industry.

Friday, January 27, 2006

 
Honor Roll Blues

Well, the kid was bragging last night that he is getting on the honor roll. He does admit he might get a 'C' in drama, which of course would prevent him from getting on the honor roll. So we are plain excited that after the scourge of lackluster grades last year, he is doing so well now.

So why my blues? Heh heh.

Well, he gets a hefty prize for getting good grades. In this case, pricey and fun electronics. Because the thought is that if a bribe inspires my boy to turn around his grades, then I'm all for bribes.

We had been tossing back the idea of an xBox or xBox 360. But recently he wanted a Playstation Portable (PSP). Advice from PSP owners made me convince him otherwise. So now we are looking at the xBox thing or perhaps an iPod. If we get any of these, any and all advice would be handy. And if anyone wants to sell us one of these items for the kid to have, let me know.

Thursday, January 26, 2006

 
Problems with Fusebox

I liked Fusebox for about a year or so. After that, I started to catalog serious problems with the framework. As I explored the OO designs of Tartan, Model-Glue and Mach-ii, I began to be able to truly articulate my issues with this classic framework design. Of course, I am also of the thought that the problems I do have with the framework might and should be corrected in the nascent Fusebox 5, planned for release whenever the Fusebox team is done.

Enough meandering... what don't I like?

Distributed configuration files with matching names
All my Fusebox 4.x series applications have followed the MVC skeleton design. That is, all controller information is in the controller circuit, all view stuff is in the view circuit, and all model in the model circuit. Alas, all of these share the same name. Which means in every IDE in use, it can be hard to distinguish them by name alone.

Compounding that is the issue I have seen of other developers having nested circuits. All with the same name. Often called/run from the controller. Which adds complexity. Being a monkey, I don't like complexity, and now what should be a simple framework has become much more challenging.

Lack of Implicit Invocation
One thing I like about other frameworks is that you have a single event class that can be called that contains all the methods and values you need to handle business logic. This way I don't need to think much about the framework and instead can focus on the fun of business logic. Fusebox doesn't have this at all. Sure the attribute scope is handy, and you can do some fun and wonky tricks with the application.fb struct, but I can't as easily create dynamic logic to work with this sort of thing. And adding an object to any of these things is very problematic, as the attribute scope is for simple values only and the attribute.fb struct is... well... the core kernal of the application framework.

No Enforcement of Business Rules
All frameworks are guilty of this to some degree, but I think Fusebox is readily guilty of it. It is easy enough for people to stick CFINCLUDEs right into circuits, and it seems to happen all the time. I try to educate people otherwise and yet it still happens. It seems to me that people without a strong OO background fall for this trap more often than not in Fusebox, which makes me wonder if it has some weird connection with Fusebox's fundamentally OO nature.

Fusebox also has no means of enforcing naming conventions, but at least it has them. Still, someone ought to write a name checker or something.

Monday, January 23, 2006

 
I am a Pythonista

On a professional level I was asked what system I would go with if I weren't doing CFMX and Java. And the only solution I would be interested in doing would involve Python. Python on Zope with Plone, or using Twisted and Nevow, or maybe even Turbogears. Heck, if I could I would get Jython into our CFMX and Java environment right now!

Why do I like Python so much?

Well, in a lot of ways I consider Python like ColdFusion on steriods. It has very similiar native types: Python possessing strings, integers, lists and dictionaries are much like ColdFusion's strings, numerics, arrays and structures. Many of the functions for both languages return values (ColdFusion breaks this frequently to my utter annoyance). Both can be used for rapid prototyping or real application development. Both can easily leverage a parent language that has some neat features to toss in (ColdFusion has Java vs CPython and C).

Python tends to look neater thanks to the indentation method of defining blocks, but well-formed ColdFusion is pretty too.

Python is stronger in the realm of OO, but both allow you to go procedural if you want.

But really, the reason why I like Python is that for a ColdFuson code monkey it was very easy to learn. And it shared ColdFusion's elegance and linked me to another world of development. It has opened doors and enlightened me in ways that have made me a better ColdFusion programmer. Python made me to find ways to push ColdFusion in new directions. And it taught me even more how to neaten my code.

Friday, January 20, 2006

 
My preferred ColdFusion Development Tools

Over the years I have found a number of ColdFusion tools that I think really enhance my ability to deliver RAD applications that are easy to maintain and expand. All of these things can be used for free, which certainly does rock!

Textpad
This is a powerful, general text editor that has tons of extension libraries. I picked it up in mid 2003 and have never looked back. So I can use Textpad to help me do ColdFusion or Python or PL/SQL or whatever. It has pretty decent regex support (no POSIX though). It is easy to install and runs fast even on slow machines. It doesn't have FTP or RDF support, and that is its only really troublesome bit. It doesn't do code complete, but I don't really need that anyway.

cfEclipse
This is a very rich plug-in for the incredible IDE Eclipse. It does so much, is free, and seems to run much faster than Dreamweaver or Homesite Studio. The SVN plug-in rocks if you get Subversion for source control. If I have the time and energy to install something that does code-complete, this is what I'll use.

cfQuickDocs
I don't like to use most function reference books besides small ones for regex and sql tricks. Having an API listed online in a format that is really fast and easy to use is my preferred way of getting necessary documentation. This awesome AJAX application scrapes content off of the CFMX 7 livedocs and serves it to you nicely.

Spike's cfcDoc
Need good documentation of your CFCs? How about in something that resembles JavaDoc? Spike's work here is awesome. Other people have extended it, but I like the original still.

Trac Wiki & Task Tracker & SVN inteface
Trac is awesome because it does so much for you and is yet so easy to use. I love Wikis for use in development. I need task tracking because I do. And I prefer a good, solid source control system. Trac helps you enable all three.

Lighthouse Pro
Ray Camden's nifty Task Tracking system, its earlier version is really light (xml holds data files) but easier to deploy. This Pro version stores it in a database and is easier to use and configure. If you can't have Trac, then get this and you can't go wrong.

 
Job Hunt on Hold

Some developments at work have meant that I am putting the job hunt on hold. Depending on how SAIC's contract with NASA goes, this means that I either will be here for another 4-5 months or another 5 odd years. Of course, I would prefer to stay, so this makes me happy.

Thursday, January 19, 2006

 
Lambda Fun

Coming from my liberal arts background, I never learned Lisp or Scheme in college. So the anonymous Lambda function in Python always escaped me. As a baby Pythonista, this was rather humiliating. So when I finally grokked it after way too much effort, it was like my brain exploded. In essence, the problem was that I thought about it too hard, when in reality, the lambda capability of Python, Lisp, Scheme, et al is actually a simple concept.

So now, of course, I've been trying to figure out how to make it work in ColdFusion. The problem, alas, is that to make it work I would have to return a function from the lambda function. And that just isn't possible. So what about returning a new object? Of course, that would destroy the beautful elegance I get in python via:

f = lamba x, y, z: x + y+ z
f(2, 3, 4)
Result : 9

Instead, in ColdFusion I could code something like:

f = lamba("x, y, z : x + y+ z");
f.lambda(2, 3, 4);
Result: 9

Basically, the ColdFusion method would be turning the nice, elegant Python function into a object factory. Now I have no problem with object factories, but is this really the way to go?

I don't know. I am wondering if doing a Lambda function is sheer overkill in CFMX.

Wednesday, January 18, 2006

 
Refactoring Code

I love to refactor code I've written myself. Finding and correcting mistakes that you made before anyone else spots them is always fun. Especially when you leverage in other people's work nabbed from the open source community. For example, config file used to say:

mailserver = "smtp.blah.com";
adminmail = "blah@blah.com";
debug = true;
datasource = "myDatasource";

And now it says:

chiliBeanFactory = createObject("component","lib.chilibeans.beanfactory").init(".#dirSep#xml-config");

configsysBean = chiliBeanFactory.CreateBean("configsys.xml");

mailserver = configsysBean.getMailServer();
adminmail = configsysBean.getadminmail();
debug = configsysBean.getdebug();
datasource = configsysBean.getdatasource();

The difference is that not only did I move basic config information out of actual code files and into an xml file, I did so without doing a bunch of coding myself. You know, various file actions and the like. Instead I used JRH's wonderful Chilibeans. I got working code in 5 minutes instead of 30.

 
Job Stuff

Amazon.com gave me a call for an interview. That certainly boosted my ego. Alas, Amazon is built using Perl/Mason and its been almost 7 years since my last effort with Perl. Sure, I know regular expressions pretty well, but I think they are focusing on just a limited part of my resume. On the other hand, they too are here on Gallows Road, so that is definately something to consider.

On the other hand, for another job, I sent in some code samples. Then realized I sent in some unrefactored code. Oops. Guess I can sign that chance off.

Monday, January 16, 2006

 
ColdFusion Humane Interface Package (CHIP)

I've been working on a Humane Interface Package for ColdFusion. So what is a Humane Interface and should ColdFusion have one?

Martin Fowler has a nice article on the subject of Humane Interfaces, and I started playing with building my own. The concept is to create a set of function libraries with logically named functions that work universally and all follow a specific order.
Basically, I got tired of the fact that in ColdFusion, some functions return booleans of successful operations (array and query functions do this a lot), and others return modified values of the operated value. This makes rapid development slower, and requires that a developer either remember every detail about every function, or have cfquickdocs always ready for access. Worse, the parameter arguments are different, which can get annoying too when for reFind the regex comes second and for reReplace the regex comes first (or is it the other way around)?

Now compare that to Python or Ruby, in which methods on a type always return a value, unless it is a decision function. Parameters always go in the same order. You have to remember less about the language, check references less, and the results are that you can code faster.

Sounds great! Well, maybe not...

The CHIP library I built has been fun, and it is in the beta stage. However, it is potentially a resource hog (tests are pending). Why rewrite the whole CFMX function library set adding a good thousand lines of code to just to make an arrayAppend return a value instead of a boolean? Also, I might not use cfEclipse (I do use this sometimes) or Homesite Studio or Dreamweaver, but others do and those IDEs have code complete.

Should I continue? I don't know. I think it has been an interesting proof-of-concept, and one that borders on Academia. But I am not so sure it has any real usefulness. And I wish someone could argue me one way or another.


 
Job Hunting

Right now I am looking for a job.

And I just turned down the highest paying job offer of my life.

The reason? Well, because they said, 'fast-paced' too much. Yes, I believe that if a firm says the job is 'fast-paced' several times in an interview, then you might be talking about a potentially messy environment. Add in no real idea of what a framework is, no use of any tools like developer task tracking, unit testing, or automatic documentation tools, and you end up with what sounds likea terrifying and very stressful job. The guys there were smart and intelligent, but I would rather at this point work in a good, clean house then in one were I would have to potentially fight (when I got the time between fires) to make any sort of changes.

Sure, the job offer paid 16% more than what I make now, and offers infinitely better benefits. But the misery and load would have chewed me up and spit me out.

And it was the first offer I got and from the first interview. Other offers will shortly be on their way. I got lucky and smart and got a job here at NASA to be a silver backed CF Code Monkey, which means 'Technical Lead'. Somehow I even convinced higher-ups to give me a pair of commendations.

So I'm not too worried about job prospects. Heck, if negotiations go the way I want here, I will stay at NASA. The chance to do Python and Semantic Web is very, very alluring.

 
Let us see how this looks

This page is powered by Blogger. Isn't yours?