PSA: Read More Code
There is a great collection of books from the Architecture it Open Source Applications (http://aosabook.org/en/index.html) series with the following introduction: “Architects look at thousands of buildings during their training, and study critiques of those buildings written by masters. In contrast, most software developers only ever get to know a handful of large programs well—usually programs they wrote themselves—and never study the great programs of history. As a result, they repeat one another's mistakes rather than building on one another's successes.”
I love this introduction: the belief of standing on the shoulders of giants. Although some people like learning by writing code, I find reading code can be less draining and more accessible. Furthermore, reading code of prominent projects really teaches you all kinds of tricks, techniques, and patterns you might not exercise from writing your own.
I see people who feel that at the end of their degree that they don’t feel like they can solve problems / write code for the real world. To them I share the above introduction and remind them, “Imitation is the sincerest form of flattery.” I’m not condoning the cheating connotation of imitation, but copying the style of writing code from industry and academic giants really helped me write code. Lots of famous open source projects also have been rewritten a lot to address past failures or mitigate them into the future. Great quality is embedded in them, waiting for people to learn.
The following is some projects I can think at the top of my head enjoying reading.
- https://github.com/square/okhttp (Object Oriented Programming for Networking)
- https://github.com/mesosphere/marathon (Dependency Injection and Actor Based Concurrency)
- https://github.com/apache/spark (Functional/Monad Collections API + Spark SQL Catalyst Optimizer)
- https://github.com/finagle/finch (Simple Functional Web Services)
The projects I listed may not be relevant to your line of work or interests, so I recommend exploring the tools and libraries you use and see how are they written to be so famous. Bonus: The AOSA have a lot of high-level write-ups on famous projects.
P.S. Share any projects you think people should read!
Posted Jul 19, 2020, 4:19 AM UTC
Don't just read more code, learn how to navigate code. Don't be intimidated by large code bases. Unless you are at a brand new startup that's just getting off the ground, at some point you're going to be asked to fix a bug in code you've never looked at. Learning to navigate a large code base, debug through it reasonably, and find flaws (or the flaw that you're looking for) is critical.
Find an open source project that you're interested in that has a public bug database, and see what you can do. The quality of public bugs is ... very hit and miss, so if you can't figure it out don't get discouraged, but keep trying.
I keep telling my dev lead I know the code base pretty well and the he asks me to do something and it's like someone snuck in like 20 new files
(They probably did.)
Navigating through code is part of the whole reading code thing.
You mean if I see somewhere in the middle of the code an exception like null exception I shouldn't just put a null check and close the ticket?
/s
Three years ago, I was on a greenfield project. I'd hit Command+N every day several times a day.
Now, I am on a project with some 20 different applications that each act indepenedently of each other except that they don't: the output of one acts as the input to another in good old fashioned Unix pipe systems except that it's using a message driven platform instead of pipes because dude parallelism. Grep and find are my friends.
It's the same project.