The diligent cowboys programmer
Move fast and make things
2015-11-10
This focuses on 4 groups of software:
- CLI tool (command line interface)
- Services with APIs
- Libraries
- GUI (both Web based and native, which includes mobile apps)
Here’s my recipe for -disaster- success:
- Extensibility and features are a cost, learn to say no.
- Move fast, version your code, e.g. use git, commit constantly, push to an
upstream repository.
- Always focus on getting functionality up and running first and foremost.
Everything else is secondary.
- Be very afraid abstraction layers within your code base. Only add on an
as-needed basis, that is, there must be at least 2 implementations of your
abstraction layer.
- Design for futureproofness. Add a version number to data structures, prefix
all endpoints to APIs with a version number, add –version to your CLI
tool/mobile app/footer of web app so callers can know if a new flag/feature
is supported or not, etc.
- Test your service on a staging instance first.
- Write a smoke test if necessary. Don’t make it too complex or too slow, just
test the succeeding use case.
- Unit test the edge cases, mainly failure cases. Do not unit test successful
cases to much, it’s redundant.
- Aim for 70%~80% code coverage, including smoke test. It’s very language
dependent.
- Always write the server (or library) and a client simultaneously. That’s the
only way to write a proper API that is as tight as possible.
- Write two clients in different languages if you can, e.g. there’s a need.
- Use language agnostic data encoding (json, protobuf, capnproto, thrift,
etc). Know what you’re getting into for each encoding. Do not use XML, ever.