Read the code!

Posted by ryansouthgate on 3 Feb 2016

You should read the code.

Not all the code, but some of it… the bits you use. I’ve been a professional Software Developer for 4/5 years now. I started off in Microsoft C# (which I still use to this day) - but more recently I’ve been working a lot with JavaScript - and even touched on NodeJS (for a day) last week.

The great thing about a lot of frameworks, server/client side (NodeJS, AngularJS, React, Ruby - to name a few), is that they’re open source. Microsoft has recently went nuclear with the .NET framework - they’ve blown open the doors and open sourced the lot.

Before this, I’d use some .Net Decomplier to view the source. Which is good, but sometimes it spits out strange names for variables and is a bit difficult to read. More recently I’ve learnt of Source of .NET - from Scott Hanselman at NDC.

Open the source

Open source is great…and slightly overwhelming too. Great because you can read the source, understand it and even contribute to it. Overwhelming because there’s usually a lot of it - mature frameworks tend to be a bit big.

My mission, starting from now, is to read more source!

In a personal project (a big SPA), I’m currently working on Facebook and Spotify OAuth integration. Facebook and Spotify Middleware are available to download - as nuget’s - simply start-up the “plugin/middleware” with your App Id and App Secret - then you’re good to go…..

That’s great…however it’s a black box - and to me, it might as well be doing magic!

For some, this black box/free functionality is awesome - no hassle and all the complexity is hidden - who really wants to know the ins-and-outs about OAuth 2 anyway??

OAuth2 security

I know I don’t - I’d much rather leave this to the experts - they’ve likely spent many more hours than me, understanding it. (Remember though - we’re all human - even the experts make mistakes….. cough heartbleed cough).

But, this doesn’t apply for everything - I’d like to know more about other areas.

Under the covers

This Facebook/Spotify Middleware is only useful for ASP.NET MVC applications (rendered on the server) - unfortunately it’s not useful for JavaScript SPA’s (Single Page Applications).

So, I’ve been reading some of the source - to understand it - to write a version that will work the way I want it to. Upon reading it, it’s not actually scary/overwhelming at all - it’s actually straightforward, the structure is logically separated and easy to follow.

It’s good to know your way around the code, for one it’s easier to get help online (Stackoverflow/github) when you can explain what you think is going on. After familiarity, you might see something that broken - and you could fix it.

Reading….

By “reading” I don’t actually mean: After you’ve had a massive Roast on Sunday, and are sitting in the lounge watching TV, feeling all cosy and sleepy - open GitHub and start reading through lines of code. I wont be doing that - that’s not the way I learn.

What I mean is (if you are like me and “learn by doing”): Read while you work, at first it might slow you down, but by keeping a GitHub window open, or cloning the source you can keep track of what you’re using, and what is actually going on under the “covers”.

My Mission

So this year, I’m going to be reading more source code, so I understand the framework I’m using - this should lead me into making a few contributions to open source software too - will be nice to get involved in the community and help out.



comments powered by Disqus