modular.bidi 0.9.0 - breaking change

24 views
Skip to first unread message

Malcolm Sparks

unread,
Feb 18, 2015, 9:03:36 PM2/18/15
to modul...@googlegroups.com
I've releaseda new version of modular's bidi adapter, modular.bidi. which contains a component which scans its dependencies looking for route-contributing components.

Prior to 0.9.0, a protocol named WebService was used. The point of (the horribly named) WebService was to allow a level of indirection between URI in HTTP requests and the handlers that served them, with keywords joining the two.

The Router component would look for WebService-satisfying dependencies in its dependency list, and intercept calls to them such that keywords could be used as targets. The Router would switch these keywords with the actual handlers when dispatch a URI. (The point of using keywords, if you don't know, is to make it easier to call bidi's path-for function).

Recent bidi releases have introduced a RouteProvider protocol which consists of a single function: routes, and has also made it easier to associate keywords with handlers using 'handler'.

For example.

["index.html" (handler ::index (fn [req] ...))]

The new modular.bidi release now depends on a new bidi release, and the router has been rewritten to use bidi's RouteProvider protocol. I've been mulling over this change for a few weeks now, and I'm convinced the old design was a poor choice. The nice thing about software is that sometimes you can go back and fix your mistakes!

So WebService has been removed entirely. If this breaks your modular application, don't upgrade to the newer library. But the upgrade process is straight-forward, remove your request-handlers function, wrap your handlers with bidi's new 'handler' wrapper, and wrap the route structure in a uri-context if necessary. One function is simpler than the 3 it replaces it.

All the templates listed on modularity.org have been upgraded to the latest versions of bidi and modular.bidi. One extra benefit is that there are no longer any lein deps conflicts in any of the templated projects.

For those of you who have built web applications based on modular, please feel free to ask my assistance if you need any help migrating, when you decide to do so. I'm happy to provide fixes for the existing 0.7.x and 0.8.x versions of modular.bidi indefinitely, if required.








Reply all
Reply to author
Forward
0 new messages