An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries for month: December 2013

clojure.java.jdbc 0.3.2 released

December 30, 2013 ·

This release contains minor bug fixes compared to 0.3.0, with the main focus being an overhaul of docstrings etc to improve the auto-gen'd documentation.

The community documentation for java.jdbc on clojure-doc has also had a major overhaul.

Details of this release:

  • Add nil protocol implementation to ISQLParameter.
  • Improve docstrings and add :arglists for better auto-generated documentation.
  • Make insert-sql private - technically a breaking change but it should never have been public: sorry folks!
  • Provide better protocol for setting parameters in prepared statements JDBC-86.
  • Fix parens in two deprecated tests JDBC-85.
  • Made create-table-ddl less aggressive about applying as-sql-name so only first name in a column spec is affected.

Please note that the 0.3.1 release is broken and should not be used.

Tags: clojure

TestBox - replacing MXUnit and providing BDD

December 23, 2013 ·

If you've seen my tweets over the last couple of days, you'll know that I've been taking a look at TestBox, the new testing framework from the ColdBox team.

You might be thinking "Do we really need a new testing framework?" and it's a reasonable question. CFML has had a number of testing frameworks over the years but mostly we've seen each one come and go as maintainers have moved onto other things: cfUnit, then cfcUnit, then a brief resurrection of cfUnit, then MXUnit. Does anyone remember cfSpec? I liked that a lot - I like the Behavior-Driven Development style of writing tests. That's why, at World Singles, we use the Expectations library for almost all of our Clojure-based tests.

So why the interest in TestBox? My initial interest was spurred by the inclusion of the BDD style of tests which I find both more natural to read and a better fit for expressing requirements for software that is yet to be written. Then I read that TestBox has MXUnit compatibility which intrigued me - we have been using MXUnit for several years at World Singles and I don't relish having to rewrite all those tests. If TestBox could allow us to run our existing "xUnit" tests as-is while we write new tests in the BDD style, I'd be very happy.

Adam Cameron has been blogging about Test-Driven Development recently and has also picked up on TestBox. He just blogged about trying TestBox on his extensive MXUnit test suite and you can see he ran into a number of issues, all of which he has reported, and which I expect we'll see fixes for. My experience was more fruitful than his - as I mentioned in my comment on his blog post: just two small changes got the whole of our suite running flawlessly!

My next challenge was integrating TestBox into our automated build / test script, which uses Ant. TestBox provides a runner-template that shows how to do basic Ant integration. I followed that recipe but discovered there was no way for Ant to see that any tests failed and so I couldn't "fail the build" if TestBox found errors or failures. After studying the source code briefly, I realized I could extend the TestBox CFC and provide a way for the runner CFM template to access the details of the TestResult object, and write a property file that Ant could read and fail if a certain property was set. Time to fork the ColdBox Platform Github repo and send a Pull Request to add build failing functionality which Luis merged in within a few hours! Nice!

With that in place, I was able to delete MXUnit from the World Singles repo and rely entirely on TestBox for all our testing needs!

Whether you prefer the "xUnit" style of tests, with assertions, or the "BDD" style with expectations, TestBox can support you, and even if you have a lot invested in MXUnit, migration to TestBox should be straightforward (especially once they address the issues Adam has raised). I think we can be sure of ongoing support and maintenance - based on the well-established track record of the ColdBox Team. I think TestBox is a safe bet. Now you just need to start actually doing some automated testing :)

Tags: bdd · coldbox · coldfusion · tdd · worldsingles

FW/1 2.2 Released!

December 18, 2013 ·

Framework One version 2.2 is now available for production use! You can download it from the Framework One page on RIAForge. This includes one bug fix over RC2 (interaction between renderData() and trace output).

The main focus of the 2.2 release is improved support for REST APIs, through the addition of renderData() to simplify returning JSON, XML and plain text results to the caller, as well as more sophisticated route handling via "resource packs" which let you define a family of related routes for a given resource type, using a shorthand notation. For more information, see this blog post about the latest FW/1 release and the roadmap.

As noted previously, the master branch is the current stable release (2.2), and the develop branch has become the next release (2.5). 2.5 will be released next month and will be a stepping stone toward some substantial changes coming in 3.0. For more detail, read this blog post explaining the changes coming in 2.5 and 3.0.

Tags: coldfusion · fw1

clojure.java.jdbc 0.3.0 Released!

December 17, 2013 ·

The "gold" release of the Clojure contrib library that wraps JDBC is now available on Maven Central. This release has been in the works for most of this year, as it introduces large changes from the previous "gold" release (0.2.3) that aim to make the library more idiomatic and easier to use in a multi-threaded functional environment. In order to provide a smooth migration path, the old API from the 0.2.3 release has been moved wholesale to the clojure.java.jdbc.deprecated namespace, and the new API in 0.3.0 uses new naming for almost all of the (new) functionality.

The main API change is the removal of the dynamic global variable *db* and the with-connection macro. Instead you now pass the database spec as an explicit argument in all calls, and you can share connections across multiple SQL operations either by using connection pooling (recommended) or the new with-db-connection macro that takes an explicit binding for (a connected version of) the database spec.

A common problem with the old API when performing queries was that with-query-results required care because the result set was lazily constructed and it was easy to let that lazy sequence escape and have the connection closed before you had finished working on the results. The new API provides a query function that, by default, fully realizes the result set to avoid that problem. You can still process very large result sets lazily by passing :row-fn and/or :result-set-fn arguments to query.

For more details of the new API, you can read the reference documentation for clojure.java.jdbc. For a summary of all the changes made since the 0.2.3 release, read the clojure.java.jdbc change log on Github. To use the library in your project, see the clojure.java.jdbc dependency information on Github.

Detailed documentation on using clojure.java.jdbc is being developed for the Clojure Documentation Site and will be found in the java.jdbc section of the Clojure ecosystems area, once the site has been refreshed from the markdown sources on Github.

Tags: clojure

clojure.java.jdbc 0.3.0 RC1

December 13, 2013 ·

Clojure's low-level JDBC wrapper inches closer to a gold 0.3.0 release with the first release candidate. Read more on clojure.java.jdbc's Github repo. The changes in this release are:

  • Deprecate db-transaction (new in 0.3.0) in favor of with-db-transaction JDBC-81.
  • Add with-db-metadata macro and metadata-result function to make it easier to work with SQL metadata JDBC-80.
  • Add with-db-connection macro to make it easier to run groups of operations against a single open connection JDBC-79.
  • Add ISQLValue protocol to make it easier to support custom SQL types for parameters in SQL statements JDBC-77.
  • Add support for :isolation in with-db-transaction JDBC-75.
  • Add :user as an alias for :username for DataSource connections JDBC-74.

The reference documentation for clojure.java.jdbc has already been updated. The Clojure Documentation Site java.jdbc section has been updated in Github, pending a regeneration of the site.

Tags: clojure

FW/1 2.2 Release Candidate 2

December 02, 2013 ·

Framework One version 2.2 release candidate 2 is now available for testing (download from the Framework One page on RIAForge). This includes a couple of bug fixes, compared to release candidate 1. See the FW/1 2.2 RC2 release notes on Github for more details. Unless any showstopping bugs are found this week, the final 2.2 release will be made early next week, merged to master, and then develop will become the 2.5 branch.

See FW/1 Releases and Roadmap and FW/1 - The Year Ahead for more information about the upcoming 2.2, 2.5 and 3.0 releases, as well as plans for DI/1.

Tags: coldfusion · di1 · fw1

A Year With Windows 8

November 30, 2013 ·

A year ago I bought a Windows 8 laptop. How has it stood the test of time?

[Read more →]

Tags: wifi · windows8