A colleague on Facebook sent me a quick question asking me about frameworks:
Why use a framework?
What are the positives about having a framework?
If you made a very simple framework without trying to code it what would you LIKE it to do?
Is there anything you think it should NOT do?
So one by one....
Why use a framework?
I use a framework because it solves a problem. I try to apply that to anything cool I see in regards to frameworks, design patterns, etc. If it doesn't solve a problem I have, then it isn't something I need at the moment. As to what problem it solves for me - it helps me deal with how I organize my files and structure the 'flow' of my application. That may seem minor, but it really relieves me of a lot of 'grunt thinking' - ie, thinking about simple crap. It lets me focus on more difficult stuff.
What are the positives about having a framework?
Well along with what I described above, it also gives my application a standard that makes it easier for other folks to work with. So given that an application uses framework X, I can hop on the web site, check the docs, and I'll be able to more easily understand it.
If you made a very simple framework without trying to code it what would you LIKE it to do?
Well, I'd look at what I like in Model-Glue and FW/1 - mainly the mechanics of handling the flow of my application. I hate to sound like I'm repeating myself, but what I described above as what I liked is obviously what I'd build into a new framework. (But let me just add - before creating a new framework, you probably want to look into working with an existing one!)
Is there anything you think it should NOT do?
As I said above, a good framework handles the flow and layout of an application. I get to focus on business logic and UI. To me - that's all a framework should do. Anything else is cow bell and not strictly necessary. I'm happy, for example, that Model-Glue doesn't do what ColdSpring does. Let each take care of their own domain.
What do you not use a framework?
There isn't a hard and fast rule for this. For "smaller" sites I probably wouldn't bother, but I've rarely seen sites shrink. Most sites grow. I didn't use a framework for ColdFusion Bloggers and I wish I had. Also, it depends on your framework. Something like FW/1 which runs completely by convention has an extremely small amount of overhead. In cases where I feel an application is too small for Model-Glue I might still consider FW/1.
In general, I tend to work with sites. I don't build tiny one page applications. So I almost always use a framework.
Archived Comments
"Anything else is cow bell"??
everybody knows you need more cow bell baby!! you gotta have more cow bell. don't be hatin' on the cow bell.
A framework, just like any other design pattern (architectural or not) provides a common semantic for communication between developers. What I mean by that, is that some one who knows nothing about the business needs of your application but has worked with the same framework, can immediately in some way understand how your application works. There is less of a learning curve when going from app to app that uses the same framework.
I suppose i need to learn a framework so i can put in on my resume and be able to work with other developers. I have been putting it off forever.
I look at the Model-Glue install instructions and step one is install ColdSpring.
Do i need to learn ColdSpring before learning Model-Glue?
@Chad: No, you don't need to learn ColdSpring. You _should_, but I believe it helps to focus when learning new stuff. When I train people on MG I focus entirely on MG and just give people a small hint as to the power of CS (and how MG helps with it).
FYI, I gave a MG presentation to some coworkers about two weeks ago. I'd be willing to give it to the CF Meetup. I just want to wait till past X-Mas.
And let me be clear - when it comes to learning MG, CS, or anything: I think it's always a good idea to learn new things. But just because you learn to do something doesn't mean you should ALWAYS use it. The biggest thing to keep in mind is that frameworks, design patterns, etc, have a time and place when they should be used.
Learning new things is always great, i agree, but with programming i tend to find that if i don't continue to use it i forget what i learned and have to nearly start over.
I built a few small flex apps last year and have not touched Flex since. I have a hard time supporting the apps now and wish i just did them in CF. BUT each time i do touch them i remember more of how it works so the learning continues just slow and painfully.
I understand the concept of MVC and i have my own way of doing it. I will give Model-Glue a shot if it can help me organize my code better and help me work in larger groups of programmers.
I just don't want to try to make my CF programming OOP.
Give me reduced duplicate code and centralized functions that are easy to maintain and i can call from any page and that is enough organization for me.
Thanks Ray!
"For "smaller" sites I probably wouldn't bother"
I think that is a sign of a framework poorly designed. A framework should be easy/rapid to implement and use from a developers stand point no matter the size of the site.
@Mike: Interesting. I'm not sure I agree though. I mean - we all know that sometimes a 'better' solution is more code than a hack. Shoot, most of the time it is. Just because the hack is quicker/shorter doesn't necessarily mean it is better. Right?
Wow.. i need a higher horsepower dev server to run Model-Glue. It is _really_ old, but simple pages take 30+ seconds to load.
True defiantly, shorter/quicker doesn't equate better and more code/longer doesn't either.
Another stumper:
Should a CF frameworks be treated like a design pattern where one solution doesn't fit all problems?
In RoR, it is seems Rails works for all size project but I am not positive. I have heard scalability issues but CF has had its bouts with those rumors also.
Interesting stuff to ponder.
It seems at times that RoR has almost evolved into its own independent programming solution (or I could even say language). Talking to developers around me, hardly anybody talks about Ruby without mentioning RoR. I see people express interest in learning RoR, and not really talk about learning Ruby (even though Ruby knowledge would be needed in any case).
In terms of CF frameworks, I am firmly of the belief that there is no one solution fits all framework here. Many times, I don't even think a framework is required.
You can write MVC code and OO code without using a framework, and you can write good code without using a framework too.
I hate to cause repetition here but I have a general question.
I use OO approaches in my applications as much as I can but I have not fully moved to a framework. I have tried Farcry and find the documentation quite hard to get through efficiently. I have heard of Mach-II, ColdSpring, MVC, Model-Glue but never had the time to really sink my teeth into the topic.
I feel I want/need to learn a framework for use with certain ColdFusion applications but I want to learn it well. I have some time off between jobs so what would people recommend as a framework I can learn quickly and soundly and have solid resources for reference and to look back on later (it frustrates me when documentation lacks for applications)?
Also, is it easy to integrate CF9's new Hibernate ORM features with a framework?
I understand these questions may be a little broad and maybe a little obvious to some, I'm just a little lost on this topic as I don't want to dive in the deepend of frameworks when I could have started out easily with a solid base for research into other frameworks later.
Thanks!
I would say CFWheels.org. It is probably most close to how you are currently coding. Take a look @ the hello world tutorial (1 and 2) and the screencasts. Also http://henke.ws/page.cfm/cf... and a preso I gave http://bit.ly/3zGlrt
PS I was in the same boat, trying other frameworks and cfwheels felt most natural and clicked.
@Mike Thanks I'll give CFWheels a go :)
@Chad: Note, by default, Model-Glue is set to reload everything on every hit. This can be/should be turned off to make it run quicker. Also, older versions of CF had a CFC-loading issue which made the first hit a bit brutal. If you are running CF8 with the virgin JRE install, you may want to update to the latest JRE (google around for more detail).
@Mike: There is never - ever - one true way to do everything. I will say though - from an organizational view - I find a MVC framework like Model-Glue to be almost universally useful since any application of a decent size can be helped on the organizational side.
Does that make sense? I don't think it does. Kumar kinda is saying when I'm trying to say here too.
@Steve: ORM is a tool. You can use ORM with old procedural apps, MVC apps, or voodoo apps. Doesn't really matter. I'm using ORM with a new CF9 app that makes use of Model-Glue and ColdSpring. It is AMAZING how productive you can be with ORM.
@Steve, there is work being done to develop an MG ORM that will support Hibernate.
CFWheels already has a ORM built in that works on:
* Adobe ColdFusion 8, Adobe ColdFusion 9, Railo 3.1
* SQL Server 7 or later, Oracle 10g or later, PostgreSQL, and MySQL 5.
I think there is development on a plugin to switch out the default ORM and use hibernate. If not that would be a cool plugin someone could build.
@Lola: I may be being picky - but I think your statement is misleading. Nothing in MG doesn''t support you using ORM. MG has always been 'hands off' on how your build your model layer. If you are talking about more _support_ for ORM, better hooks, thats something different.