Wednesday, June 16, 2004

Why seperate business logic from presentation?

It sounds logical, but I think it really handicaps us as developers, because too often, that CAN not MUST leads to the left hand not knowing what the right hand knows.

100% of all my work has been alone, developing applications, that integrate business logic with presentation. Maybe I am the only one who does.

But there comes a benefit, by having done all of the work, I have a better macro and micro picture of the application.

And I think this is actually a plus, because I strongly believe complete application knowledge is important.

I am just indicating that this is the better approach, I acknowledge it is the more painful approach, but I still belive it is the long-term better approach.

Now I am not saying all things about mvc, or fusebox or mach-ii are bad.

We obviously have to try a lot of things, different ways of looking at things, and seeing how we can improve speed, efficiency and performance.

And obviously there are different needs as a 1 man developer vs a team developer.

But you need to see both ends of the consequences of those approaches.

While I agree that the different methodologies can speed up the process of developing the application, but how do they train you to make sure you can do all parts of the application?

P.S. Now as most of you know my style by now, seem to understand that I am contra-trend, or contra-fad, or seem to be a luddite of some kind.

In reality, I am neither, I am here because I want to challenge your assumptions, make sure we are all making good decisions and the right decisions.

I am no guru, but all I want is an honest discussion of how we can move coldfusion further ahead.

As one of my favorite quotations:

I may disagree with what you say,
but I'll defend to the death you're right to say it.

Have a great day all!


  1. Anonymous11:16 AM

    Well, I was giving you the benefit of the doubt until now, Craig, but with that post you've lost me. I'm officially blocking you from my Goog feed. Goodbye!

  2. Separating logic from presentation just makes life easier in the long run. There's really nothing more to it. But by all means, combine them together. Experience is the best teacher!

  3. I think I understand, I am saying things that are not what everyone else says. I am not just agreeing with how things are, and just going along with the flow.

    That's what honest discussion is about, being willing to hear and listen to what other people have to say, and then evaluating if it makes sense or not, or what can we learn from each other.

    Then you listen to me, crystal clear. I am not here because I want to be the next big blogger, I am here because I have something different to offer, something unique. Whether that is a better thing, only you can decide.

    For too long, I've had all kinds of methodologies shoved done my throat, and different new technologies down my throat.

    You can't possibly be a good coder, unless you're using the latest whatever the heck the new trend is.

    And I'm saying, that makes completely no sense at all.

    Instead of evaluating solutions based on their practicality, people evaluate on whether it's popular or trendy or it's the next new big thing.

    This is what I have gotten from fellow coders, recruiters, managers.

    They just don't understand the classical values of doing a good job, well, efficiently and built for the long-term, doing things the right way.

    If you want me to lie and say whatever x technology or methodology is the right way to go, all the time, I am not going to lie or disrespect any of you, by lying to you.

    I am telling you the undiluted truth.

    1. I never say my answers is the answer for everyone, as long as people are willing to accept it for whatever IN thing they are pushing as well.

    2. My goal is for us to go up a higher level, so we can prove that coldfusion is a top solution for almost any web problem.

    That higher level in my mind has nothing to do with a specific technology or methodology.

    It has to do with making sure that we as an industry release products that we can be proud of, that we did so well, that a week/month later, we don't have to go back and fix whatever we never did right the first time.

    It's about using the right sql statements/commands to force yourself to always code for scalability, none of this "Select * from table or view" idiocy.

    If you like you can call me the Rush Limbaugh of ColdFusion or Michael Savage.

    You do not have to like me, or respect me, all i ask is that you listen to me, and see if anything I say, has value to you.

    If it does, share it back.

    Thank you.

  4. The problem is that I'm not even sure where to start with your statements. It's like, "Everything you know is wrong or a waste of time. Discuss."

    I understand your motivation--I think--but your methods leave quite a bit to be desired. We don't really need any CF shock jocks.

  5. There's nothing wrong with not jumping on every technology bandwagon. Some work great, others also work great. Like Morihei Ueshiba said "There are many paths up Mount Fuji, but they all lead to the top".

    I'm probably more like you know than you think. I'll fight tooth and nail before I'll change a process that I know is working for me. I question, argue and rant about why to change. I find it helps me understand my current process and the new process someone else is suggesting. If a new idea can survive my moaning about it, I won't only use it, I'll understand many intricate details about it.

  6. Anonymous1:53 PM

    You talk about 'moving CF forward' but then you promote practices that have long been discredited or are seriously outdated. No one is going to force you to learn OO or even the basics of what the industry considers to be best practice but after a while you're going to find yourself unemployable because you can't compete on a skills and practices level.

    Steve (Nelson) makes a good point about not fixing what ain't broken but his success comes from using a framework that provides exactly the separation of presentation and business logic that you are eschewing. That separation allows for scalability of an application (not the performance-based scalability which you mention - more below) and that's what allows people to build bigger, more comprehensive applications without creating a maintenance nightmare. Sure, for the one man shop building small apps, your approach may well work but I wouldn't want to inherit your apps to maintain!

    As for performance, you fall into the common trap of equating micro-optimization with scalability. True performance scalability is not about linear speed but about behavior under load and the ability to grow your infrastructure in a reasonable way to cope with increased traffic. Almost all scalability comes from architecture and algorithms - not low-level code tweaking.

    Your blog is interesting and thought-provoking but I sometimes wonder whether you really believe what you write or whether you're just being contra to get a reaction... :)

    Sean A Corfield

  7. Seriously outdated???

    What about humorously outdated?

    I think I prefer the later.

    All kidding aside.

    I really am not trying to be a shock jock, but I also don't want to just be a conformer that just says what everyone else says.

    Maybe part of my strong reluctance to go oo,flash and what not is that I am not sure that I can go there...

    And I still love coding the old fashioned way, call me the cdfh(related to bofh) if you must.

    Then why is ColdFusion looked down so much by other parts of the web?

    I'll talk more in a new post.

  8. When asked to code presentation apart from logic, it is to help you and help others too. A good coder is a smart one who do all the hard work upfront to spare himself lots of heart ache later.

    Imagine trying to use same logic for another job? what do you do? Just think...

  9. Anonymous4:02 PM

    Easy, if it's something I coded recently, i just grab the code from where i saw it last, and cut n paste.

    Or if it's for the same site, I just use a cfinclude.

  10. I agree with you on many points. Including the "WHY" to follow something only because somebody say it's good (even if many say that). Yes it need to be given a chance, but NOT to follow blindly.

  11. This comment has been removed by a blog administrator.

  12. I used to have that same "if it ain't broke, don't fix it" attitude towards my coding habbits. No matter what I'd read in developer journals, text books, online, etc, about frameworks, coding standards/guidelines and the like, I just thought that it really didn't apply to what I was doing. After all, I was building fairly simple applications. But, as time went on, and those "simple" applications got more and more complex, I began to realize that my job could have been a lot easier had I taken the time to study, learn from and implement some of those same guidelines and techniques I thought I didn't have use for.

    I learned my lesson, and these days, all my applications go through a detailed planning and design process that employs tips and techniques that I've learned over the years. It's not a perfect process (none exists), but I can assure you, I'm spending more time innovating and making myself a better programmer then I am maintaining and fixing broken code.

  13. Personally, I love abstraction (model seperate from view) purely so that i can:

    - Perform some harness testing on my model, without having the view interfere.
    - Delegate the work amongst other members of my team more effectively plus allow them to be as creative as they want in many parts.
    - Make allowances for the future, in that say in a 5 years the browser slowly becomes obscelete if you have made a large application, this could be a big blow. At least you allow yourself the oppurtunity to take on views like FLASH or similiar without impacting on the Model.
    - Allowances for the DataBase to be swapped out and replaced with whatever big plus especially in my case were we had an informix db and looking at MS SQL for the future.

    Abstraction is an annoyance as sometimes you feel like your taking 5 steps to do something you could do in 1 or 2. Thats the price.

    As for you being a 1 man shop, well I too am one privately and i still adhere to the principal of abstraction, mainly so i can recycle my logic and in many ways my views.

    I ecourage people to adopt "Webcontrols" which are smart custom tags, mainly so you don't have to spend all your time doing IF statements on TD tags or DIV tags etc.

    Its got lots of positives that outweigh the negatives, its just making sure you pick a framework/methodology that suites you as a developer for each project you work on. Don't follow things blindly, as you then are relying on the initial inventors to be your saviour every time you come accross a problem where do you gain in that?

  14. Anonymous10:33 PM

    Sure there are some great 3 tier approaches out there. But lets be honest - there is some overhead to learning and using them.

    So, In many ways I have to agree with this guy.

    I've been coding for 15 years, and putting view/logic in one spot is one of the fastest ways to get a bit of code going. Sure I've used the beautiful Grails approach, tried Seam hello world, and really like Flex with a nice java backend.

    You've got to admit, since 2004 until 2008, we've experienced a lot of growing pains as the MVC stuff has been coming out. Remember all the pains of EJB 2.0? This guy would have still been plugging away with simple / effective techniques while we would be buried in an unwieldy approach.

    Not every 'enterprise' approach is appropriate for a project, nor is it the only way to keep 'organized' code.

    I've seen a bit of software be written this 1 tier way, and the company is now worth $250 million. It's still running on it, and I must admit the code is a bitch to code on. But that's because they didn't take the time to occasionally break up a page here or there.

    No one ever talks about happy in betweens, like a 1.5 tier approach where much of the code is single tier until you need to break something out later for better reuse.

    I mean, I don't see anyone here giving credit to the idea that tier 1 is Agile by the fact that you can bust some things out quickly, then show, reflect, modify and go again...

    -Travis Somerville

  15. While I'm not a CF programmer, I believe programming practices relate to ALL programming languages. Anyway. There is no room for your 'punk, non-conformist' attitude in our world of programmers. Separating business logic from presentation logic is something that should simply be done. There is a reason 99% of smart programmers do it: it keeps code clean; it lowers the risk of a designer coming in and messing the code it; and it also allows for easy code-reviews down the line. Procedural programming, something I guess you must be stuck on, is slow, repetitive and a chore.

  16. Now that I have worked on a site, where it wants lots of customization, then it became clear to me the value of seperation of logic and display.

    But most of the time i rarely need that functionality.

    So i can now see the need for the seperation, but it depends on the situation.

    While I am now seeing the value of a good framework. I am just not sold that one of them is good for me.

    But I just really do not like all the disrespect I get because I am not just blindly following the pack.

    If what the pack does makes sense, I am all in, if it does not. I am not.

    All I am trying to do is, are we making these decisions based on common sense or experience or based on the situation as it is? Or on opinion of fads and trends...

    It's like politicians, do you really trust people who just follow the current opinion polls? Or those who have their own opinion based on experience and common sense?

    My 2 cents...

  17. Anonymous2:20 AM

    You sound like a fake person trying to blindly follow the opposite crowd. You know, the cool kids in junior high school thought everything was uncool.