Do you need to know computer science to write code?

Written by aaronedell | Published 2017/12/22
Tech Story Tags: programming | computer-science | developer | learning-to-code | self-improvement

TLDRvia the TL;DR App

I’ll begin with a story that is not too dissimilar to the piece I wrote about learning to code late in life. I was terrified to learn to code, but partly because I somehow got it in my head that you needed to be a combination math and engineering whiz to do it.

I struggled with math my entire scholastic career, occasionally doing well, but mostly not understanding what the hell was going on (I’m looking at you calculus). I saw this as a big barrier to entry for learning to write code, as everything about programming that matriculated into my cultural understanding seemed to make it clear that you’d need to be a computer science major to be a developer. But I have subsequently learned that that is not true, in fact, I’m going to argue for the opposite.

In my amateurish and perhaps oversimplified view of computer programming I see several different types of code, and applications of code, that correlate with skill, interest, and competencies. I don’t think this was always the case as there was a time when computer science was the domain of the math department. Punch card-era machines were used to solve complex math problems, and as computer science evolved, so to did the engineering principles behind them. But with that came layers of abstraction.

Abstraction is critical to technological advance, partly because it enables mindshare to pursue more complex and grander solutions to societal problems. Consider self-driving cars (one of today’s most advanced and impressive technologies). In order to employ machine learning to detect stop signs, certain computer vision technologies would need to be built. In order to build those, high level programming languages would need to be developed. For high level programming you’d need low level programming first, preceded by an operating system, then by a kernel, then by integrated circuits, and so on.

Today there are programming languages, libraries, and tools that let you build some powerful solutions to problems, without having to create or understand the underlying math. Most of us are, at this point, familiar with tools like Wordpress and Wix. Anyone can create beautiful websites, it is no longer just the domain of the HTML programmer.

But if you’re considering learning to code, know that the plethora of tools and shortcuts are myriad, and require no understanding of math, algorithms, or equations. My first code project was a Facebook-like website that requires a login and password, can display an infinite amount of photos, and lets users comment on posts. I built it without having to know or understand complex math, and therefore (I’d posit) I didn’t need to know or understand computer science. All I needed was a clear problem to solve, some classes in PHP, Javascript and MySQL, and the ability to Google things.

I’ve built many little projects since and the most difficult math I ever had to implement was some simple algebra. Most functions you’ll write at the beginner to intermediate level will just iterate through arrays, which means all you need to do it count. Consider this PHP snippet which will scan a folder for images, post each image to an advanced object recognition service (machine learning), and push the results to a website:

$trimmedfiles = array();$result = array();$files = scandir(‘check’);

foreach($files as $file){switch(ltrim(strstr($file, ‘.’), ‘.’)){case “jpg”: case”jpeg”: case”png” : case”gif”:$pathtofile = “check/”.$file;

$tagbox = json_decode(checkTagbox($pathtofile),true);

$results[] = [“detail”=>array(“tagbox”=>$tagbox,”thumbnail”=>$pathtofile)];}}

echo json_encode($results);

function checkTagbox($a) {

if (function_exists(‘curl_file_create’)) { // php 5.5+$cFile = curl_file_create($a);} else { //$cFile = ‘@’ . realpath($a);}

$body = [‘file’=>$cFile];$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, “http://localhost:8080/tagbox/check”);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $body);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);curl_close($ch);return $result;

Consider the powerful, advanced feature this enables; detecting objects in images and returning the name of the objects to some other system that can display it, search it, etc. You could build an entire AI-enabled e-commerce site based on little projects like this. And I’m by no means an advanced (or even good) developer. Imagine what you can build with tools like Machine Box and libraries like jQuery that are designed to abstract complex and otherwise prohibitive code and math.

If you’ll note in the code block above, there is no math, not even a single integer digit. That’s because languages like PHP make it really easy to iterate over a directory X number of times where X = total number of files in the directory.

If you want to get into coding and developing, don’t let a fear of math stop you! You’d be surprised how little math you actually need to know in order to build powerful things. There is still a great deal of genuine computer science out there, especially when you get into building machine learning models or understanding blockchain, but if you pay close attention, you’ll start to notice that the general democratization of those technologies begins with abstracting the math.

There’s never been a better time to jump into coding, so do it now.


Published by HackerNoon on 2017/12/22