The Scourge of the Google Coder

This above all””: to thine own self be true, and it must follow, as the night the day, though canst not then be false to any man.

William Shakespeare, Hamlet

There is much the internet has given us but one area which many people seem to lose site of, as its integration with the every day seems so entrenched that one doesn’t know life without it.  Why did I quote Shakespeare and then talk about the internet?  I will get there.

But first, the title.  The Google Coder and I am not referring to the person who does development work at Google.  I am talking about a person so adept at finding any piece of code on the internet and using it within their application.  What is wrong with this?  Lots.

See the code below.

Module Main

    Private Const DO_NOT_EXCEED As Integer = 4000000
    Sub Main()
        Dim firstNumber As Integer = 1
        Dim secondNumber As Integer = 2
        Dim newNumber As Integer = 0
        Dim evenSum As Integer = 2

        'Display the first number numbers
        Console.WriteLine(firstNumber.ToString())
        Console.WriteLine(secondNumber.ToString())

        'While the new calculated number does not exceed the max amount
        While newNumber < DO_NOT_EXCEED
            'Calculate the next number in the sequence
            newNumber = firstNumber + secondNumber

            'ouput the new number
            Console.WriteLine(newNumber.ToString())

            'Flip the values around for calculation
            firstNumber = secondNumber
            secondNumber = newNumber

            'Check to see if the number is an even one
            If newNumber Mod 2 = 0 Then
                'Check to seed if the number does not exceed our max
                If newNumber > DO_NOT_EXCEED Then
                    'if it does, exit the loop
                    Exit While
                End If

                'add the number as it is an even number.
                evenSum += newNumber
            End If

        End While

        'output the answer
        Console.WriteLine()
        Console.WriteLine(String.Format("The sum of the even numbers in a fibonacci sequence that do no exceed {0}", DO_NOT_EXCEED.ToString()))
        Console.WriteLine(evenSum.ToString())
    End Sub

End Module

This is a solution to a problem posed;

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

This is my code, hand written without help from anyone.  The problem also comes from a site called Project Euler which sets out problems that is to be solved using a computer language.  The number of languages used is staggering for many they would be querying why are there so many languages when they all function to do the same thing, enable a computer to solve a problem.

But the purpose of it is to enable you as the developer to solve the problem using all your bags of tricks.  The problems are designed in a manner that often a large number are involved and often workout out problems based on these large numbers and working things out repetitively, the purpose built domain of the computer.  I might hear some people say, “why?”, “Why bother doing all that work, for nothing or doing all that work when you can easily look up the answer on Google?”.  True.

Why would I want to work out something on my own?  Why would I like to press submit on the answer screen and get a correct status up knowing that I did it, all by myself without any help and I got it right the first time.  I might not have been the first to do it, or written the prettiest code, the fastest code.  But to me, it isn’t the purpose.  When at work and I am writing code what is my objective with that specific problem.  Well to get the desire outcome.  It is a key for any developer to know the problem and understand it, then using the tools develop the solution.  Now often the problems are far more complex than determine the sum of the even Fibonacci numbers that is not greater than 4 million.

What would searching the answer or code to get the answer do for me?  Speed.  Nothing else, it doesn’t teach me anything, in fact I can go as far as saying many tutorials set up are great but don’t do much to aide in the learning process to enable proper retention, but that is something else.  I remember a while ago I competed in a coding competition which pitted developers against developers, with nothing but a barebones Windows PC and Visual Studio, no internet, no phones a pen and paper next to the PC.  We had to solve a problem, in a given timeframe.  I got into the top 10 but my time ran out.  But it was interesting to see that there were about 60% who dropped away after the first couple of problems, mutterings of it being impossible, anyone who solved it must have been cheating etc… I put these people into the Google coding camp, they were unable look for the solution on the internet and therefore they couldn’t work it out.

Is this detrimental to the overall coding quality?  Who knows?  I have seen some terribly written code in the years, not saying mine are works of art.  In fact the most efficient code is possibly not the easiest to maintain.  But it comes to this saying;

Only write the code that only you can write.

This comes back to the quote from Hamlet about being true to yourself.  In coding, one might think something like this

int myNumber = 10;
myNumber++;

is the only way to increment 10 by one.  But what about the following;

int myNumber = 10;
myNumber += 1;

Or;

int myNumber = 10;
myNumber = myNumber + 1;

Or

int myNumber = 10;
int i = 1;
myNumber = myNumber + i;

This is the issue as well.  Each of these do the right thing, they increment 10 by 1, but they use different methods to do this.  You might argue that the first version was the correct version.  But the others are also correct, they do the job, and if it is different to what you do, is it wrong no, it is an opinion.   But is that a problem for today where so many people believe their opinion is the right one and fail to understand that they have their opinion as well as I have mine and everyone else’s has theirs.

So, I guess what I am getting to is, write code, your way, the way you want to.  This might go against some other posts where I have spoken about terrible coding, but when you go to Google you aren’t writing your code.  By all means use it as a resource, find out the interface to the API workout what to put in, but don’t just copy and paste it as you will learn nothing.  Plagiarism is a problem with this world as we expand our use of the internet in all walks off life, it happened in University where there were always someone wanting to take the easy path, copy the code, rename the variables and move a few things around and boom, it is now yours.  But like all things it isn’t you if you do that, your techniques, approaches to development aren’t prevalent and if there is anyone who knows you will find that out.

Use the internet, but don’t rely on the internet and as technology becomes an ever increasing crutch the world relies on we will become more and more reliant on it being the correct answer to everything which puts Google (only because they are the dominant player in searching) in a position to fulfil any chosen agenda they wish and they are doing so, more than anyone knows.

Advertisements

Posted on February 5, 2015, in Article, Development and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: