Lots of our people have lots of opinions. Here are just a few of them
ThoughtWorks embraces the individuality of the people in the organization and hence the opinions expressed in the blogs may contradict each other and also may not represent the opinions of ThoughtWorks.
I have a common command-line pattern I grew tired of typing. An example
$ mvn verify | tee verify.out
I use this pattern so often as I want to both watch the build on screen, and have a save file to grep when something goes wrong. Sometimes I also find myself telling the computer:
$ mvn verify | tee verify.out $ mv verify.out verify-old.out $ $EDITOR pom.xml $ mvn verify | tee verify.out $ diff verify-old.out verify.out
I want to see what changed in my build. But ... too much typing! So I automated with
gee, a mashup of …
If you need to store your users' passwords, it's essential that you never store them plainly. Instead you must store a cryptographic hash of them, so that people who get access to your database don't get the passwords. Cade and Daniel explain how to do this properly: salting the hash to avoid lookup table attacks, and using an appropriate hashing algorithm to defend against well-equipped attackers.
I got tired of downloading my own scripts from Github when working among multiple projects. So I automated it, of course. The bitsh project reuses a test script from the shell project, and now the
Makefile for bitsh is simply:
SHELL=/bin/bash test: @[ -t 1 ] && flags=-c ; \ ./test-bitsh.sh -i -- $$flags t
By the way, why "bitsh"? I hunted around for project names combining "git" and "bash" and found most of them already taken. Beggars can't…
Most programmers do not take full advantage of the languages they work in, though some languages make this a real challenge. Take metaprogramming, or programs that have some self-knowledge. LISP-family languages make this easy and natural; those with macros even more so. Bytecode languages (think Java), and even more so object code languages (think "C"), fall back on extra-linguistic magic such as AOP rewriting.
Text-based languages lay in a middle ground. Best known is Bash. Rarely do programmers take full advantage of Bash features, and few would think of metaprogramming. Not as clean as LISP macros, it…
My coworkers use many ad hoc or single-purpose scripts, things like: checking system status, wrappers for build systems, launching services locally, etc. My UNIX background tells me, "keep it simple, avoid output; Silence is Golden."
Somehow my younger colleagues aren't impressed.
So to avoid acting my age I started sprinkling color into my scripts, and it worked. Feedback was uniformly positive. And true to my UNIX roots, I provided command line flags to disable color.
Some lessons for budding BASHers: