How to code like GeoHot
Refine your coding approach by learning from software developer and entrepreneur, George Hotz.
May 28, 2022 - 6 min read
TechCrunch: George "GeoHot" Hotz Presents the Comma One at Disrupt SF
Who is GeoHot?
George Hotz, also known by his online alias GeoHot, is a professional problem solver. When he isn't solving the autonomous vehicle challenge (and actually delivering shippable intermediaries) he hosts 6 hour long twitch streams, where he tackles difficult programming challenges.
From these coding sessions we can learn some powerful lessons in problem solving and programming.
Research the competition
While he only alludes to this during his twitch streams, George spends significant time learning about existing products, reading textbooks, and exploring research papers. You might argue that this is only applicable for PhD students at the forefront of technology, however, doing so will provide you with an understanding of the underlying theories and mathematics.
Researching your chosen topic will uncover other projects within the space; ranging from paid off-the-shelf products, well supported GitHub libraries, and more importantly, shady code from *insert your favourite programming forum here*. While paid software may save time and effort, homebrew applications can provide personalisation and learning.
Utilise existing libraries (only the excellent ones)
Achieving goals quickly will require you to import libraries; proven and standardised commands for a range of tasks (often adjacent to your primary software goal).
These libraries are often written by programming enthusiasts and self-made experts. Individuals (and sometimes teams) who spend their downtime fortifying and optimising their library of choice.
For those who like to code every line from scratch, have at it. Just understand that you are walking well-trodden ground.
Fundamental project aims
When starting a new coding program try to keep these requirements in mind:
- Tiny: GeoHot's software packages start with the term 'tiny' for a reason. He finds pleasure in producing small but powerful programs. Aim for less than 1000 lines of code.
- Fast: Don't forget to import the time module. You will need it for calculating loop durations and efficiency.
- Best in class: Aim to beat the competition. If you are placing energy into a new piece of software aim to make it the best.
- Open source: Using a platform such as GitHub will allow other programmers to review and enhance your project. It may also help others trying to solve the same problem.
- Beautiful: He may not use the term 'beautiful', but George is known to make substantial changes to code if he finds it untidy or unappealing. The final code should be pleasing to see and easy to interpret. (2 space tab FTW)
Speed, speed, speed!
George Hotz (2022)
Quick proof of concept
Now that you have an understanding of the concept, competition and available libraries, leverage these resources to quickly code a proof of concept. Identify problem areas of the project and systematically solve each one.
- Outcome 1: You hit a wall and need to pivot your approach or project scope.
- Outcome 2: All concerns are overcome and you can move into refactoring...
In some cases you might decide to abandon the project altogther, walking away with new experience and learnings.
Refine and refactor
You have achieved a working version of the software, but the project is only half complete. Apart from fixing errors and memory leaks, you now have the chance to tackle the fundamental project aims listed above. Replacing specific commands and blocks of code can yield improved speed and efficiency, while refactoring the code will provide simplicity and beauty.
Bugs are very expensive.
George Hotz (2022)
Practice, practice, practice!
Congratulations, you have now built your first 'Tiny' app. Continue to develop the app or move forward to the next exciting challenge.
Exploring different programming languages will provide a better understanding of their benefits, applications and limitations. Along with a better understanding of abstraction. George recommends starting with Assembly, C and Python. Furthermore, you will likely discover programming languages you enjoy and coding challenges that consume your free time.
Coding Standards
- Less than 1000 lines of code, excluding comments, empty lines, and test code.
- Indent using 2 space tabs.
- Functions to have less than 10 lines of code (where possible).
- No empty rows within functions, 1 empty row between functions.
- Comments next to code used sparingly (see below examples).
- Descriptive variable names: lower_case_text
- Short function parameter names: ctx, x, y, shape
- What is good code: short, powerful, easy to read, easy to understand, efficient, nothing hacky, no try/excepts, deals with all edge cases
Coding Standards: Commenting
# ***** section heading *****
# function description
# https://www.w3schools.com/python/ref_func_print.asp
function fname (x, y):
print("Hello World") # prints hello world
# TODO: lowercase explanation
Coding Standards: Example