Entries Tagged as 'ColdFusion'

Why developers don't need Object Oriented Programming

ColdFusion , Rants 11 Comments »

I'll admit straight away that my background is in procedural code, way back before Object Oriented Programming (OOP) had not been dreamt up, or maybe just no one bothered to tell us humble COBOL programmers!

I started coding with ColdFusion on version 4.5 and the code I wrote was very much like this Form posts to action page that relocates somewhere that displays some links that show more Forms etc.

No framework no structure, spaghetti of the worst sort.

So I looked round and decided to adopt fusebox as a framework and this improved my code a great deal separating out data access, business logic , and display code.

Later versions of fusebox made this even better by forcing the use of XML in the flow of control from request to request, stopping the leak of business logic into the flow control.

Now like every good developer I'm lazy, so if I find myself coding something twice I start to wonder how I can make that code common and call it. The answer of course is to get data access and business logic which is liable to be called from multiple places into cfcs.

I learnt to make my functions as cohesive as possible (focused on as tight a purpose as possible) because that helps to make the API's clean and simple.

I found that making functions only dependant on their arguments, with no other dependencies on variables in shared scopes, made changing code much easier and more predictable. Not like the days of relying on variables passed up from nested custom tags!

So I started to believe that maybe I'm doing OOP already?

Well... NO because I'm still think procedurally.

If someone says to me we need a program that makes a cup of tea, my first thought is not

I'll call the kettle factory and the tea pot factory, inject the tea pot and the kettle into the cup of tea object and then call the makeTea service method which will know how to make a cup of tea by magic.

I expect that's how you guys make your tea, but us 'ol folk work through a process :-)

Kettle must be available

Teapot must available

Ingredients must be available from the 'Tescos' datasource.

Need to 'display' my tea to the user in a 'cup view'.

(work with me here ok?)

So since my system regularly needs to make tea I have Kettle and TeaPot cfc's instantiated in application scope with any init() method already run. But NO injection of other objects.

(gasps of horror already)

So earlier I said I didn't make my functions dependent on any shared scopes; well I lied because they do call other cfc functions by directly referencing functions something like this application.teaPot.openLid().

(more gasps of horror)

I don't have a service layer, data access layer and domain layer as such, but I do have functions grouped logically together in cfcs and by following the principles of cohesion and loose coupling the functions inside those cfcs start to adhere to that pattern automatically as you think through and re-factor code.

There is NO inheritance. So if I see a call to application.kettle.switchOff() I can open the kettle.cfc and find a function called switchOff and see what it does. I don't have to chase up some inheritance tree to find the actual function.

I have NO beans. CF gives us queries as a great way to pass around record sets. Sometimes a structure or an array might be more suitable, but either way CFQUERY and a bit more CF is all you need. If I need to maintain the code that saves an address record to add a new column because of a database change I want to see only a handful of SQL queries and the CF code that works with those record sets. I don't want to see multiple layers of code encapsulating the address record as a bean with bean factories and getter and setter for each column, too many additional lines of code to look at to understand, to go wrong or get wrong.

What about Aspect Oriented Programming (AOP) I here you cry. How do I handle cross-cutting concerns such as logging and security?

You know what? I would rather have the ugly but easily understood

application.utils.log(stuffToLog=stuff)

wherever I need it than the very clever but much more hidden and tricky to understand XML of ColdSpring.

Security can be nicely handled as a plug-in at the application.cfc or fusebox level.

I think much cleverer people than me have taken some very good concepts and developed them to their logical conclusions, but in so doing have lost sight of the wonderful speed and agility that makes CF such a great language in the first place.

Keep the principles foremost but also the KISS principle 'Keep it short and simple' or 'Keep it simple stupid!' And if it makes sense to break a rule once the pros and cons have been considered, then break it!

If this has enraged you mightily please let me know where I have gone wrong :-)

Development/Testing Efficiency and using Selenium Firefox plugin

ColdFusion 3 Comments »
One of the snippets of advice in the Neal Ford's Productive Programmer (reviewed here) was to use the Selenium firefox plugin to speed up repetative testing processes

To paraphrase Neal Ford....

So imagine a wizard like set of screens and you are testing step 3, you have to repeatedly fillout the forms for steps 1 and 2 to see the latest change you have made for step3.
With each change and test you think - 'ah just one more change and I'll be done....' ten changes later you are still working on this!

I found myself in just such a loop and eventually downloaded and installed the Selenium plugin to firefox and created a macro to run through steps 1 and 2.

No setup is required. You will find the plugin under the tools menu and it opens a popup window already in 'record' mode for the current site you have open. Go through the screens as normal and Selenium records all clicks and key strokes.

Next time you need to test just click on play in the Selenium popup window.

This was a really big time saver - I wish I had done it right from the start!

Book Recommendation - The Productive Programmer, Neal Ford , O'Reilly [ISBN: 978-0-596-51978-0]

ColdFusion , Books 2 Comments »
This book is an easy to read set of hints tips tools and theory to make you as productive as possible in your development work.
It is in two parts.

Part 1 highlights a whole series of tools (the 'Mechanics') to make you more productive.

Part 2 focus on various practices to make you more productive.

Neal uses Windows, OSX, and other Linux flavours in his day to day work so he mentions tools on all 3, or sometimes just hidden features of the OS itself. Some stuff I already knew but I found a wealth of goodies which I have been trying out since.

He structures these tips around the headings of
  • Acceleration - doing stuff quicker
  • Focus - doing stuff without distractions
  • Automation - getting the computer to do the hard work
  • Canonicality - making sure we have just one copy of things
The Canonical section was particularly interesting with good examples from his experience (which I could relate to) of times when not having central, common copies of certain resources can trip up and delay or damage development. Source control is the obvious example, but Neal has several more.

Part two of the book looks less at the Mechanics and more at how you work; the 'Practice' of being a productive programmer. Again some of his topics were familiar to me already, such as Test Driven Development, but most had new slants.

He ends this section with some interesting views on how programming languages are developing for the future. Neal sees more domain specific languages and that these will be used in combinations to solve problems.

The book has is own wiki at http://productiveprogrammer.com for you to contribute or discuss the topics raised.

Every development team should read this!

Railo Keynote at Scotch on the Rocks

ColdFusion 2 Comments »
Gert announces that Railo joins JBoss.org and therefore Railo is fully open source.... For a proper analysis of this announcement see my colleague Peter's post here

Senior CF Developer Wanted — Croydon, Surrey, UK

ColdFusion 4 Comments »

I am the System Manager working for the company that is hiring below and thought an advert on my blog would be a great way to reach a large group of CF developers

Senior CF Developer wanted — Croydon, Surrey, UK

Who are we?

We are a well established, international, multi-million pound group of companies, working mainly in the Business Travel sector. We have offices around the world. This position is based at our offices in Croydon, Surrey in the UK. You can check out a couple of the websites of the companies within the group iapa.com, prioritypass.com

What is the role?

We run a number of membership systems with a combined global membership in excess of 1 million. We run public websites and distributed backoffice systems all written in Coldfusion. Currently these run on CF7 (moving to CF8 after the first updater :-). Some of our code base is fairly new and some a few years old and in need of a re-write. We are currently investing more heavily in our systems so that we can deliver a more professional, more efficient and more cost effective service to the business. To facilitate this we have a new IT Solutions Director in place and have recruited a project manager dedicated to the IT department. We are now looking for 2 senior CF developers who can bring industry best practice to our operation and help us to become a leading CF development site.

This is a great opportunity to influence the way our CF development department grows and develops.

What do we offer?

  • A competitive salary
  • Medical Insurance
  • Contributory pension scheme
  • Life assurance
  • 25 days holiday
  • Corporate discount at Virgin Health Clubs
  • Discounted travel insurance
  • Friendly working environment and a great team!

What skills do you need?

  • A passion for developing great code
  • Demonstrable CF coding skills
  • Demonstrable in depth knowledge of the CF language
  • Strong HTML, AJAX, JavaScript and CSS knowledge
  • Strong SQL and general RDBMS knowledge
  • Experience of the full development life cycle
  • A passion for new technology and applying it to best effect.
  • An understanding of development methodologies processes and best practice.

What skills would be a bonus?

  • Fusebox5 framework
  • SVN
  • CFEclipse
  • JIRA (issue tracking system)
  • Selenium (automated testing tool)

How to Apply

If you are interested and live within a reasonable commute to Croydon and are eligible to work in the UK then please forward your CV including full contact details to michael [dot] traher [at] iapa [dot] co [dot] uk, detailing your current salary, your desired salary and your availability / notice period.

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds