Writing about the craft of software

Notes on Unix, Python, databases, design, and building useful systems.

SQL Formatting

Let's standardize how we write SQL. What joy. Rarely, have I seen consistency in how SQL is formatted, and often it is not even considered. Here is the standard I use which makes it easy to read both simple and complex queries. Here is an example: select b.id…

database, Elegance, SQL

Read article →

Unix House Keeping

Where is everything? Where do files go in Unix? There are no bonafide rules. But we're free to invent some. So here are mine. The Heap /data - Everything starts off in this subdirectory. Consider it the Heap from which all other areas are carved out of. We're…

Uncategorized

Read article →

Programs should be like Gardens

I believe programs should be like gardens. They should be lovely to see. Gardens are things we walk around in and return to often. Gardens are things we wish to spend time in with others - to relax in and enjoy its beauty. If we strive to make your programming…

Design, Elegance

Read article →

Variable Naming Conventions

A simple rule to help improve convention and maintainability: Camelcasing should be used when dealing with Objects, Everything else should use underscores. Objects Class definitions should be CapCase Objects should be mixedCase Class Methods should be…

Design, Elegance, SQL

Read article →

Defensive Programming is the way to go.

Defensive programming is like defensive driving: Anticipate everything that might go wrong. If a function is passed an Id to a database table, do not assume that it is a valid Id, or an integer, or even that it has a value. What is most important in defensive…

Design, Elegance

Read article →

Working Towards the Ideal

Whether building a new system, or trying to untangle some untenable rats nest of code -- One should have an image of the ideal state in their mind. If we draw up the best plan we can, thinking in terms of the perfect - regardless of its immediate feasibility -…

Design, Elegance

Read article →

Libraries over Frameworks

What is the benefit of using a framework like Ruby-on-Rails, Pylons or Drupal? Simply put, it helps us start and develop code from nothing quickly. But it does not have long lasting staying power. If you plan to be using the system for years to come - the…

Design, Elegance

Read article →

Data Layer is King

It is far better to have an excellent Database Design and a crappy Application Layer, than an excellent Application Layer with a crappy Database design. Why is that? Simply put, you can always skim your Application code off the top and write a new one. But you…

database, Design, Uncategorized

Read article →

Why SHOUT in your SQL?

Somewhere someone started the tradition of capitalizing keywords in SQL. Its like shouting all the unimportant parts of the code and making what's important harder to read. SELECT b.id as book_id, a.name as author, b.pub_date as publication_date FORM books b…

Design, SQL, Uncategorized

Read article →

Pull Requests improve Quality

A Pull Request, which might more sensibly be called a Merge Request, is the act of a someone asking another to merge his or her code into theirs. It is all so civil. It solves an age old problem of how to do code review, in a more effective less disruptive…

Elegance

Read article →