G.G. Series – Being a Good Programmer: Understanding

This post is part 2 of my ongoing G.G. Series – Being a Good Programmer. This post is all about understanding. Updates will be posted every week or two so stay tuned!



This one also happened back when I was still working at my first job. I was ignorant back then so bear with me.

(Wondering out loud)

Me: Why does String start with an upper case s? I mean integer, boolean and char all start with small letters.

Junior Dev: Woah you’re right, i wonder why.

Senior Dev: Its because Strings are objects. The other things you mentioned are primitive data types which is why they start with small letters.

I don’t remember who the other junior dev in this story was. Sorry guy! The senior dev who answered my question shall remain unnamed for the time being because I have yet to ask him he minds me putting his name up on my blog.

The moment my senior dev answered my question, I was blown away. It was such a simple answer, yet it was something that honestly never occurred to me. I had somehow gone through five years of engineering without ever wondering about that.

Some of you might be saying that the answer was obvious and that if I had just thought about it, I would have arrived at the same conclusion. I can honestly say that no, I would not have arrived at the same conclusion. Simply because our minds were on different levels.

Sure I could write code in Java, but when came right down to it, I didn’t bother to understand the programming language I was using. I knew that Java was an Object Oriented programming language, but I never really thought about objects in that way.


Why Should I Bother Understanding?


Now when I talk about understanding, I don’t just mean understanding the syntax of the programming languages and how they work. Programmers working for big companies or small start ups all know that even the simplest projects need a lot of things. Text editors, IDE’s, test runners, test frameworks, debugging tools, servers, databases, and even word processors.

You should understand what you’re using because it saves you time.

Picture this, a programmer spends days writing (bad) front end form validation code for an AngularJS application.

Said programmer could have finished the same task in a couple of hours if he spent the time understanding what AngularJS could do. Why? Well because AngularJS already ships with validation directives.

A good programmer would not have wasted time reinventing the wheel because a good programmer would have seen that the vehicle was already fitted with after market performance enhancing wheels.

You should understand what you’re using because it makes you competent.

A programmer spends hours wondering why an alert does not show up when a button on the web page is clicked. Another programmer takes a look at the code, types up a line to log an error into the Eclipse IDE console and the bug is found.

If said programmer knew how to log errors in Java (or the fact that it was even possible) he would have saved himself the embarrassment and time.

A good programmer would not have needed to bother another programmer with such a trivial task.

I’m sure that there are many more reasons to understand the things you are using, but the prospect of saving time and not looking like a fool should be enough to scare anyone into trying.



Where Do I Start?

Your starting point to understanding will depend on what you’re using. However I do suggest that you take a look at the documentation for whatever you are using.

You would not believe the amount of tips and tricks the Eclipse Java IDE documentation contains. And that’s just for the Java specific version of Eclipse.

If the docs seem to be too much for you, you could always look for tutorials that talk about the basics of the things that you are using.

Take a look at this Tutorialspoint JavaScript tutorial for example. Not only does it teach you how to declare and assign values to JavaScript variables, but at the beginning of the tutorial it shows how in JavaScript, there is only the Number data type. Whereas in Java this would be separated into byte, short, int, long, float and double.

Or this Tutorialspoint Eclipse tutorial that teaches you how to debug a Java application.

You do not have to become an expert on whatever programming language, IDE or other tool you are using. It is just important that you understand what it is capable of.

This understanding of why something was made and what it can do might cause you to ask questions. Questions that hopefully lead to answers. Answers that you can use to help you be a better programmer.


G.G. Series – Being a Good Programmer: Communication

This post is part 1 of my ongoing G.G. Series – Being a Good Programmer. This post is all about communication. Updates will be posted every week so stay tuned!


First of all, yes I have a  story for this one too.


Back when I was working at my first job, I did’t really think that it would be a problem if I didn’t know the exact terms for things. I honestly thought that I could get by as long as I knew how to code.

I didn’t notice it at the time but when I think about my conversations with the managers or senior developers or the other junior developers it would go something like this:

Senior Dev: What are you working on?

Me: That thing with the page titles.

Senior Dev: The what?

Me: You know, the link thing? The one that goes on the top part of the web page. With the links for all the other pages?

Senior Dev: Ok…

If I had known that what I just described is commonly called the “navigation” I would have saved the senior dev some time and I would not have looked like a fool. A lot of the conversations with my workmates and bosses was like this but no one ever said anything about it.

In fact, one time instead of talking to me about shaping up and learning what things were called, another dev decided that it would be easier to just fix my mess after we had a miscommunication about a spec. Sure it made my life easier that week, but it made both of our lives harder in the long run.

Anyway, a couple of weeks after the anniversary of my first year in the company I met with the HR manager for my annual assessment. Imagine my shock at finding out that the senior developer who assessed me had the nerve to note that I was bad at communicating.

When I think about it now it makes sense but at the time it ticked me off. I spoke English well, how could anyone think that I was bad at communicating? The HR manager didn’t really understand it either so we brushed it off. She didn’t think it was important enough

So the people in my office had to endure a couple more months of my bad communication skills before I decided to quit.


Why Is Communication Important?

Well duh.

Seriously though, when I say communication I really mean two things. The first is defined as “the successful conveying or sharing of ideas and feelings”. The second would be defined as “social contact”.

My story shows about how failure in each one made it harder for me and the people I interacted with to do our jobs.

Had I known the proper terms for many of the things I was working with, I would have saved everyone a lot of time and prevented a lot of headaches.

Had anyone told me upfront that my bad communication skills were making things hard then I probably would have done something about it.

Proper communication between developers helps create better software. It helps minimize meeting times. It makes everyone’s lives just a little bit easier. It will even increase your value as a developer.


What Do I Do About It?

The big problem here is that it will be hard to learn about things if you don’t know what they’re called. You can imagine them in your head and type descriptions into google but even the almighty google is not perfect.

what is a navigation

well sure google understood me THIS time..

The way I learned was to look for tutorials on the topic that I wanted to learn about. How to tutorials are very useful.

Lets say you want to know what the parts of a web page are commonly called, look up a tutorial on how to make a web page. This tutorial will most likely go something like, Part 1: The home page, Part 2: The Navigation, Part 3: The Footer, etc.

The overview of the parts alone will teach you what things are called. The explanation of these things makes it easy to remember what they are and what they’re called. It’s that easy. There shouldn’t be any reason for you to be unable to increase your vocabulary of programming terms.

Why didn’t I just look up programming terms and memorize them? Well I tried that. It was just too boring and reading a list of terms didn’t really help me remember the terms.

If you’re the other guy in my story and you have to deal with devs that are the way I used to be then good luck.

I kid. Just be honest with them. Having a good handle on programming terms is not an optional thing. you don’t just make it easier for you, but your’e also helping someone grow as a developer.

Hopefully the person you talk to doesn’t take it as an insult and takes your advice. If they don’t do anything about it though, maybe you could talk to one of your superiors about it.

G.G. Series – Being a Good Programmer: Introduction

This post is part of my ongoing G.G. Series – Being a Good Programmer. This is the introductory post that explains why I am writing this series. Updates will be posted every week so stay tuned!


Being a good programmer is not something that a lot of us in the industry really think about. Becoming a successful programmer is something that is always on our minds but when you really give it some thought, being good and being successful are not always the same thing.

This is because the people who are in charge of things like our salaries or positions are not always programmers themselves. For them, success is measured in other ways. These can be things like the number of overtime hours you put in or the number of bugs you can fix in a day. Things that are not necessarily traits of a good programmer.

In my G.G. (Get Going) Series: Being a Good Programmer, I plan to talk about the little things that programmers forget or sometimes even willfully ignore that have big impacts.

Things like, communication in teams, community, importance of basic knowledge, to name a few. At the moment I have not planned the posts further than the three topics I mentioned but there will be more than enough time for me to think about other topics.

Why Should Anyone Listen To Me?

I admit that I do not have enough industry experience, nor do I consider myself a good programmer. Not yet anyway, but that is the goal that I am trying to reach.

I feel that by putting everything I feel is important here on my blog for everyone to see, I can help someone else by making a trail that leads to becoming a good programmer.

Just to put your mind at ease, I will be sharing sources and echoing the teachings and opinions of others rather than my own. While I do believe that I have things to say, there is a lot that has already been said by people with years of experience.

What Now?

So now you sit back and wait for my next post, and I will do my best to write a post worth your time.

Test Driven Design Keeps Code Clean

Disclaimer: I won’t be explaining Test Driven Design in this post because I feel that I lack the necessary information required to do so. I am planning to do it sometime in the future but at the moment I just want to talk about one of the effects that Test Driven Design has had on my code.


A while back, during one of my chats with my friend Gervel Giva, I happened to mention my lack of skills when it came to testing. At the time all I knew about testing were terms like black box testing, white box testing, unit testing, integration testing and end to end testing.

During our chat Gervel also happened to mention something called Test Driven Design. For those of you who know me, I obviously had no clue what this was.

Luckily the topic of Test Driven Design came up at a time when I was doing my best to become more than just a code monkey. I started reading about Test Driven Design and testing in general.

Since I don’t learn much from just reading things, I used Test Driven Design on one of my projects and let me tell you, Test Driven Design is awesome.

Why Should Anyone Care?

There are many reasons to use Test Driven Design, but my favorite is the fact that it keeps your code clean. If you are like me and confusing code pisses you off (especially when it’s your own!) then this reason alone is enough to think about getting into Test Driven Design.

The very basic gist of Test Driven Design can be summarized in a few points:

  • You write a test based on the specification (since the code does not exist yet, this test will fail when you run it)
  • You write enough code to enable the test to pass
  • You refactor the code to clean it up (remove duplication, move it if it fits better somewhere else, etc.)

So how exactly does Test Driven Design keep your code clean? It all boils down to the fact that when you are writing the code, your goal is not to make the whole module work, your goal is to pass the test. Since the unit test is a very basic feature, your code also ends up being “basic”, a better term however would be clean.

The Bottom Line

Right now, the prospect of being able to go through my code without getting pissed at the mess has made me a fan of Test Driven Design. The cleanliness of my code does more than make it readable though, it also frees me from the fear of changing things that work on the chance that I destroy the whole system.

If you want to find out more about Test Driven Design, here are some links to articles that I believe you will be able to understand. I understood it (after some time) so i’m pretty sure that you will too.

AngularJS: Read the Docs!


So I’ve been unit testing my AngularJS app using $httpBackend lately and I’ve been wondering about how I’m supposed to verify that the data that I am mocking is correct.

I spent a couple of hours on the internet looking for the right answer. Feeling nothing but frustration at the fact that nothing seemed to be exactly what i’m looking for.

Those of you who are used to unit testing using AngularJs’s $httpBackend are probably laughing at me right now. The rest of you are wondering why.

Why is Everyone Laughing?

Wondering why everyone is or should be laughing at me? It’s because if you bother to go to the AngularJS docs for $httpBackend, you will see this paragraph without even having to scroll down.

During unit testing, we want our unit tests to run quickly and have no external dependencies so we don’t want to send XHR or JSONP requests to a real server. All we really need is to verify whether a certain request has been sent or not, or alternatively just let the application make requests, respond with pre-trained responses and assert that the end result is what we expect it to be.

I re-read the paragraph and boy did I feel silly. The docs are saying that unit testing with $httpBackend only hopes to achieve two things.

  1. Tell whether a certain request has been sent or not.
  2. See if the applications response to requests the way they are supposed to.

The thing is, those request responses are written by you. So there is no need to check if the response is correct because you wrote it.

Laughing at me now? Don’t worry, I was laughing pretty hard at myself as well.

My Advice to You

Here’s the thing, if you ever find yourself using AngularJS make sure to read the docs. The AngularJS docs are very thorough and all the answers to your AngularJS questions are right there.

It might take a while for some of us to get the jargon (ok fine, it took me a while. It still does) but don’t let that get you down. AngularJS is amazing and all of the time you spend going through the docs is less time you spend wasting your time looking for answers to silly questions.

AngularJS File Load Order


TLDR: I didn’t want to use RequireJS to load my files and modules without understanding what the proper order of files and files in a module should be.

So I’ve slowly been making my AngularJS code modular by following John Papa’s Angular 1 style guide.

Awesome right? I mean who wouldn’t want modular code? I tell you it’s a great thing and it really gets you deeper into the mindset of an object oriented programmer. However it is not without its drawbacks.

Lets say in your quest to make you code modular you break down a modules controller file into three controller files. They’re all the same module but since that module has three views, you decide to break it down to a controller per view.

Sounds easy so far right? You feel pretty happy with yourself and then you run your AngularJS app and boom! Señor console tells you that this or that module doesn’t exist.

Who did the what now? All you did was break one file down!

I hear ya’ man. It happened to me. Naturally, I did what anyone would do and googled the proper order of files. I was however quite unsatisfied with the answers. Basically they amounted to use RequireJS or some other JavaScript module loader.

Now don’t get me wrong, I have nothing against RequireJS. In fact I am planning to use it. The problem is that I absolutely HATE using any library, framework or tool that I don’t understand.

I am not some elitist or ivory tower sort of guy. Far from it. I just hate having to debug things I don’t understand or scrapping hours worth of work just because one gear in the machine is missing.

AngularJS File and Module Order Debugging

So how exactly do we know if you’re only problem is the order in which files are loaded and not something else? Well the two things:

  1. We are sure that we loaded all the files
  2. The error looks like the image below

module order error

There are two things that we care about in the image. The first is the error message telling us that the module is not available even when we were sure that we included the file for that module. The second is the message telling us where the “missing” module was called.

Those two pieces of information make it easier for us to figure out which file should come first. In this situation all we have to do is load the file that contains the declaration for the module ’emr.services’ before emr.services.data.js.

Thats it! Pretty simple right? Took me about an hour on the internet to figure that out. Its embarassing yes but I wont lie. I figured it out didn’t I?

Theory: Why Does It Work That Way?

So if you’re like me, you don’t call it a day after simply solving the problem. You have to know why it happened in the first place.

Now the reason for the error might be very obvious for a lot of you but it wasn’t for me. With the billions of people in world, I am certain that there is, at the very least, one other person struggling with the same thing.

Congrats buddy! This one’s for you.

Now the problem comes from the breaking down of one module into multiple files. When ordering these files, the file that contains the module declaration will always come first.

Pretty simple right? That’s because even though we broke that single module down into multiple files, it is still a single module. Naturally the file with the module declaration comes first.

“Wow Reggie. I can’t believe it took you an hour to figure that out…”. I know right? With that in mind I hope that that one person out the billion gets to read this.

JavaScript: What is it?

Backstory: Javascript and I

Back when I was new to web development, I did my best to stay away from JavaScript. Long story short, JavaScript scared me. Especially since every time I heard about JavaScript was when a colleague would tell me that it’s a “part” of jQuery, and if wanted to use jQuery I would have to learn JavaScript.

Well dang, I was going  to have to learn two things at the same time? Count me out!

Yes, I agree. Those are not the sentiments of someone who wants to be a great programmer. Those aren’t even the sentiments of someone who wants to be a competent programmer. So what was the deal?

Well my biggest reason for staying away from JavaScript was that I was afraid. I was afraid that if I started I would not be able to handle it. Looking back, I wish that I could have gotten over my fear earlier because learning JavaScript has changed me as a programmer.

What JavaScript Is Not

First of all, JavaScript is not Java. Knowing Java will make the syntax easier to remember and roll with, but the way things work in JavaScript will make you realize that it’s a whole different type of pokemon (yes, yes I did just do that).

If you’re interested in learning how JavaScript was born, you can read a “short” history about it here.

So What Is It?

JavaScript is a scripting programming language. It is one of the programming languages of the web. If you google JavaScript, you will find that although it is not Java, it is also an object oriented language.

Basically that’s it. I mean, think about it. With html and css alone there isn’t much that web pages can do.