PSA: Read More Code

New Grad

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.

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

13715
clockwork000Sr. Software Engineer•

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.

49
MediocreDot3•

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

8
clockwork000Sr. Software Engineer•

(They probably did.)

3
matusaleeem•

Navigating through code is part of the whole reading code thing.

4
April1987Web Developer•

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

3
thephotomanVeteran Code Monkey•

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.

1
Urthor•

Piggybacking off this is style guides. Nothing helped me more to produce legible code than copying the Google style guides.

It's not just about linting.

5
therunningcomputer•

You got a link that outlines it?

-6
Urthor•

Google "google style guide yourlanguagehere"

5
timmyotcMid-Level SWE/Devops•

People need to read good code, bad code, good code again, then bad code again. Then they need to learn how to morph the bad code into good code.

This is my favorite refactoring video https://www.youtube.com/watch?v=aWiwDdx_rdo

4
AmbitiousRent0•

I get the point you're trying to make, but I think framing this as something new grads should do is a little crazy. Your typical new grad who wants to be a Java backend developer probably can't even read the OKHTTP source, let alone takeaway real insight from how the code is structured. I'm experienced and know OKHTTP and Retrofit pretty well and I'd say it would probably take me a couple weeks to really get a feel for it on a more the superficial level. AOSA is dope though, I definitely agree with your larger point.

2
iLoveRaviolis•

This is great thank u sm! Im going into my junior year for CS and im deff worried about not knowing anything tht the real world would need us to know... deff appreciate this!

1
zninjamonkey•

Best is to get an internship at a decently sized company, preferably tech company

3
treasy2•

Don't read OpenSSL, that's my only advice

1
PotatoWriter•

Is it just me or is reading more code outside of work just a huge pain in the ass? I understand there are people who live and breathe programming and good for them but I'm fine dealing with whatever I see at work. I get exhausted reading through what is most likely poorly written code by other people and after a while feel like jabbing a needle into my eyes. I personally cannot do it for self improvement or fun.

1
MegasVazeloktonos•

!remindme 1 month

1
MegasVazeloktonos•

!RemindMe 1 year

1
brickcitymeng•

Thanks for the PSA, I wouldn't have known to read more code without your post.

-1