I am almost there

I have been working on yet another code generator for ColdFusion for the last six months. I have learned a lot. When I am done.... it will read a databse and using the metadata and it will create a working app using the ENTIRE database. It is like a mini Ruby on Rails.

You point it to the data source and a destination dir, press enter, and you have a working app. You can go from zero to working admin for a 20 table database in about a minute.

It also:

  • Generates client side validation based on the data type (string, numeric, float, date, etc.).
  • Generates time and date pickers for date/time fields.
  • Generates inline wussywig text editors for Text fields
  • Automatically generates and populates drop down boxes using foreign keys .
  • Has optional secondary validation using key words in the column name (like email, phone, fax, zip, etc.).
  • It is almost entirely Object Oriented and uses a very simple MVC methodology.

I am pretty pumped and have been working on this every chance I get. When I get it done, (It really snow balled from what seemed to be a very simple idea), I will be able to crank out a working app, with a couple of clicks, in a matter of minutes.

And yes, I will be releasing it open source.

ColdFusion Rocks

I have been fighting it. The FUD, the slim job market, the abuse. But I have given in again to the lure of CF.

I have played with and or made production apps with PHP, ASP, C#/ASP.NET, Java/JSP/Groovy, Ruby, ROR, PERL and so on.

And the one thing I have noticed is that for a lot of the above languages writing a simple app (say in Java/JSP) is like swatting a bug with a sledge hammer.

With ROR, you have to know a bazzion hand shakes to do something that is SUPER SIMPLE. Like trying to group output by category:

http://instantbadger.blogspot.com/2008/02/i-still-miss-cfoutput.html

Or with PHP where everything is odles of noodles spaghetti.

HTML is spaghetti, SQL is spaghetti, dynamic JS is spaghetti.... You will go blind trying to debug dynamic JS generated by PHP.

ASP? As Sid said in '78: No future for you!

ASPX/C#? Code behind? Poor excuse for OO. It never made sense to me. ASP.NET is smart and well designed but the whole Code behind thing gave me a rash.

I do like the VB and C# syntax. Especially C#

BTW JS browser issues irritates me to no end. i.e. "GODDAMMIT just FARKING WORK!!!!"

But CF? It is so simple, so smart, so damn easy. The easy stuff is idiot proof, the harder stuff is a cake walk compared to other languages. And the hard stuff? Do you even have to ask?

You need to do something? Chances are there is an out of the box tag or function for it. Need to do some heavy lifting? You have COM, the entire Java and .NET library at your command. Not to mention most any Java class including most everything at Apache.org and Source forge. Or you can roll your own.

What else you need? AJAX? Done. Frameworks? Done. ORM? Done. Code Generators? Done. Scaffolding? Done. Unit Tests? Done.

Ever update a database record with one line of code using three variables?

I didn't think so.

Popeye is a Singleton

I am what I am and that is all that I am.

From Wikipedia

In software engineering, the singleton pattern is a design pattern that is used to restrict instantiation of a class to one object.

This is just ridiculous

I was looking for a form builder that would read a database and build my forms. AKA scaffolding like RoR does. I have a home brewed one but it it is like 5 years old and is really primitive. Then I ran into this http://www.objectbreeze.com/ and thought "mutherfarker... the guy beat me at my own game...."

See... I just wrote a function that would do all my crud functions with one line of code... But it relied on code generated by the Illudium PU-36 Code Generator generator http://code.google.com/p/cfcgenerator .

I thought I was so cool.... such a bad ass. I worked really hard to get my head around beans, gateways and DAO's. Not easy stuff for the n00b.

But this guy. He just wrote a bunch of classes that does all your database operations on the fly. It is not like other ORM's or code generators that reads the database and generates your crud objects/code like RoR, Hibernate (Java) or Transfer ORM (CF). This thing does it on the fly. So if you changed your database structure it doesn't matter one bit. You don't have to regenerate your queries or your crud/database objects... or anything. Hundreds if not thousands of lines of code per application... GONE!

This is so bad ass. All you have to do is load up a data structure and send it to an object.

<!--- create an employee object to hold the form data --->
<cfset vars.employee = vars.oB.objectCreate("Employee") />
<!--- load the form data into the object --->
<cfset vars.employee.setProperty("employeeID", vars.employeeID) />
<cfset vars.employee.setProperty("fName", vars.fName) />
<cfset vars.employee.setProperty("lName", vars.lName) />
<cfset vars.employee.setProperty("email", vars.email) />
<!--- commit the employee object --->
<cfset vars.employee.commit() />

That is it! DONE DEAL! This is going to save me SO much time....

Even if it can just save me from five "Click and Saves" for each table with cfcgenerator or regenerating my crud functions with a ORM framework everytime I make a change to my database I will be better off. Especially when you have a database with 50 or 100 tables, this adds up. For my latest site, generating my crud objects with cfcgenerator would take at least 20 min of mindless "click, wait, click, wait, click enter click enter click enter click enter click enter" for each table.

And I would have to regenerate/change at LEAST 6 files every time I made a change to my database.

Work smart. AND hard.

New entries, tutorials and Java

I have been trying to write a bunch of intro level tutorials outlining my travels into OO CF land. I had to write a very simple CRUD app for our HR dept that would allow them to list links and documents to our intranet at work. So I took the opportunity to implement the CFCs generated by Brian Rinaldi's Illudium PU-36 Code Generator. http://code.google.com/p/cfcgenerator/

Like all of my projects it has snow balled out of control and now I have working examples of how to use the out of the box CFC's created by Brian's Code Generator as well as examples for ColdSpring, Mach II, Model Glue, Transfer ORM. All are very basic and are very descrete in that the only do one thing. No mixing of concepts or frameworks.

Also of note is that I have gotten into Java hard core. I started doing exploratory searches into Java, IDE's Frameworks and the lot.

I have been messing with the NetBeans IDE and I am really quite please with it. It has a very Visual studio feel to it and the doc and tutorials are very newbie friendly.

What I like the most is that the Java Language itself is pretty friendly. I mean the API is staggering in size but the language is something I was comfortable with thanx to my dealings with ColdFusiob and .NET

Another note of interest is that for the first time I have looked at learning a new language with wonder and awe. I am not intimidated by my ignorance. I am actually motivated by it.

It is like "Huh, what does this do? COOL! I can use that to do this. What does that thing do? You mean I can dump out all my DB records by just doing that? AWESOME!!!!"

The most important thing about learning is ones attitude.

The biggest obstacle to learning is the presumption of knowledge.

Yeah, that is a quote by me. Google it.

http://www.google.com/search?num=100&hl=en&newwindow=1&safe=off&rlz=1B3GGGL_enUS233US233&q=%22The+biggest+obstacle+to+learning+is+the+presumption+of+knowledge%22&btnG=Search

CFC's and performence

I am parsing out data I had collected with a survey engine I wrote. The whole thing is relational so the results only have ID's and the returned value of the answer (which is either another ID or a string). So I query of all the results and then I use a query of a query to tease out the answers for each question for each user. Like so:

<cfquery name="get_Results_ForUser" dbtype="query" >
                        SELECT    Survey_Results_ID,
                              NUM_Survey_Results_Value,
                              MEM_Survey_Results_Value,
                              LKP_Survey_Main_ID,
                              LKP_Survey_Question_Type_ID,
                              LKP_Survey_Question_ID
                        FROM    retget_ALL_Survey_Results
                        WHERE    LKP_Survey_Question_ID = #Get_Survey_Questions.Survey_Question_ID#
                        AND      LKP_empid = #Ralph#
                     </cfquery>

But when I took it and stuck it in a component to tighten up the code like so:

<cffunction name="get_Results_ForUser" displayName="Gets Results For a User " hint="Takes a query of all the questions for a survey and returns jsut the Questions For that Category" access="public" returnType="query" output="true">
      <cfargument name="retget_ALL_Survey_Results" displayName="Get_Survey_Questions" hint="The Query that has ALL the Survey_Results" type="query" required="true" default="NULL">
      <cfargument name="Survey_Question_ID" displayName="Survey_Question_ID" hint="The Questions ID" type="numeric" required="true" default="0">
      <cfargument name="LKP_empid" displayName="LKP_empid" hint="The emp id" type="numeric" required="true" default="0">
   
          <CFSET var Q_get_Results_ForUser = "">
   
         <cfquery name="Q_get_Results_ForUser" dbtype="query" >
               SELECT    Survey_Results_ID,
                     NUM_Survey_Results_Value,
                     MEM_Survey_Results_Value,
                     LKP_Survey_Main_ID,
                     LKP_Survey_Question_Type_ID,
                     LKP_Survey_Question_ID
               FROM    retget_ALL_Survey_Results
               WHERE    LKP_Survey_Question_ID = #Survey_Question_ID#
               AND      LKP_empid = #LKP_empid#
            </cfquery>

      <cfreturn Q_get_Results_ForUser >
   </cffunction>

It took a HUGE performance hit on the scale of ten fold. The render time for the page that called it went from 400-500 milliseconds to 7000 milliseconds. I read that there was overhead issues when using scripts, UDF's and components. Now I know.....

OO CF "Clicked" today. PSYCH!!!!

MVC and OO CF "Clicked" today. I started building a RSS aggrigator today and BAM!!! Light bulb! A city of lights, all at once. I am going to bed early tonight. No movie. No TV (Not that I will get to sleep any time soon). I want to get up early and wake up fresh. I am too tired (moving again) and fried to think any more tonight. Thanks to all the CF bloggers and my boss Michael R. that helped me along on this path. FARK YEAH!!!

Calendar

NAVIGATION

Recent Comments

RSS

Search

Subscribe

Tags