I am sick and tired of pieces of code arbitrary put together when they do very different things, so I shout:

Coders, please, make libraries!



I see this happening in every language with the worst cases when they are related to web. If you think you haven’t suffered from this, think again: The code to make a graphical, or any kind, of interface to a program, doesn’t have anything to do with the code to manage data in a database. The code to handle web interaction, that is, parsing HTTP messages, handling sessions, and provide whatever other methods to easy the coding of web applications doesn’t really have anything to do with templating libraries.

Let me give some examples (without naming names -except in counter examples-; you’ll easy recognize if what you are working with has this problems or not): You make an impressive web application, it has a web server and some data. There’s some data abstraction and tomorrow you have to build a desktop GUI around it, but oh! your desktop program has to depend on the web framework because the functionality to make the data abstraction is in the web framework. A counter example is Common Lisp clsql, an independent library that you may end up using with any application. There are other cases.

Coders, please, make libraries!

Now the reverse example: you need to make a web-site around already existing data models, that means you have to keep a data abstraction layer around only because it comes bundled with the web framework. Ack! But here we see a deeper problem. Are you sure you’ll be able to do it at all ? The web framework may depend on you using its own data abstraction mechanism, in the best case you’ll just loose functionality, in the worst, it won’t work.

Coders, please, make libraries!

Same happens for template libraries. I have already picked my favorite templating system, yet every web framework ones to make me use its own. Why ? my own is superior, I know it well, I want it! In some cases, I just loose some functionality, like the form builder, because it is not really ready for different template systems, in some cases it is very painful to have to do lot of boilerplate code on the side and suppress the still-present template system. The counter example here is Common Lisp tbnl, a web building library that doesn’t ship any templating functionality.

Coders, please, make libraries!

An URL parser, sure that is part of a web framework, right ? Yeah, because web browsers don’t have anything to do with URL parsing (I bet there’s absolutly no url parsing library that is used in one web server and one web client at the same time).

Coders, please, make libraries!

But it is handy to have all on in one. Ok, make a shell, a bundle, containing all the separate libraries and ship it.

Coders, please, make libraries!