Monday, September 12, 2016

Programming made simple.

With the advent of DevOps, more and more people are finding the needs to do basic programming.  While the need to do programming for "non-programmers" is mounting, I see that a lots of people is looking at programming as a tall mountain and they are finding this hurdle difficult to overcome.

This blog post has the intent to try to make programming a easy task for "non-programmers". This post is for programming in general and is not any programming language specific.

All programming language can be simplified into 3 basic operations or ingredients.  These are the building blocks for all programming languages be it the simple "Hello World" or as complicated as artificial intelligent software.

The 3 basic building blocks are:
  1. Assignment
  2. "If-then-else" / conditional statemen
  3. Iterations


Most computer program has to deal with data manipulation.  Often time a block of memory is reserved called a variable.  This variable should be named and also with a meaningful name to remind even the author of the program as to what the variable is for. Some programmers are lazy and name their variables x, y and/or foo instead of meaningful name such as return_code, username ... etc.  (As a side point, when developing a a software program, all the logics seem so obvious but then 3 months down the road in the middle of the night, we might be scratching our head asking, why did I write this logic).

Anyways, getting back to the topic, assignment is when we assign a value to a variable.  Depending on the programming language, some variable are very strict in the type of the variable.  If a variable is reserved/declared as integer, we can only assign a number value to this variable.  There are other programming language such as Python that the type is not checked by the interrupter/compiler.  Type checking is another big topic that we can look into and in this post we will just concentrate on the 3 building blocks of computer programming.

Example of variable assignment in go:

var string1 string
string1 = "Hello World!" 
fmt.Printf("I just wrote my first program: "%s", string1)

Depending on the context, the variable "string1" may not be a good name to use as it did not reveal how this variable is being used.

If-then-else or conditional statement

This is called the conditional statement and different programming language has different syntax to express the conditional statement but the concept is the same.  Depending of the condition (or the value of certain variables) the program will execute different sets of logic.

The format is:

if condition A {
 do something
} else {
 do some other thing

The "else" part is where condition A is not true.  Or we can be checking the condition in anther way:

if condition A is not true "
 do something
} else {
 do some other thing

For example:

if _, err := checkMonthIndexSize(i); err != nil {
fmt.Printf("\n%s\n", err)
} else {
fmt.Printf("\nSlice is initialized correctly (len = %d)\n", i)

The above logic is written in go and it is only for demonstrating purpose.  This is a more complex construct of the if-then-else logic where we we execute a function and depending on the return value or error condition of the function to decide if we should print out an error message or a informational message.

The if statement is checking for the return value of the function checkMonthIndexSize().  I have not include the function as I am only trying to illustrate the "if-then-else". The function checkMonthIndexSize() returns a value where we choose to ignore and the build in error checking feature of the go language.

In fact this is taken from the demo program that I have written for one of the episodes in "30-days-in-committmas 2015".  If you are interested you can find the podcast here in YouTube


Programming usually involve in doing the same operation multiple times or depending on the value of a variable.

Most programming languages have the "for-loop" and the "while-loop".

Example of a for-loop:

for i := 6; i < 12; i++ {
fmt.Printf(" [%d] := %s\r\n", i, string1[i])

Usually a "for-loop" will do 3 things:
Assign a value to a variable and this case i := 6
check certain condition and in this case if ( value of the valuable is less than 12)
increment the value of i by one and in this case i++ or it can also be i = i + 1)

Example of a while-loop

while ( condition is true) {
 print a "dot" on the screen

This is good for user interface.  Let say we are doing a file transfer using ftp and we can see the progress by seeing dots being printed to the screen and we know the file transfer is still happening.  (Over simplified example for file transfer logic for illustration only).

So we can see this value assignment and condition checking is being used in the for-loop or while-loop.

Happy programming

Of course there are more to programming but this post is trying to help you get over the barrier and start programming.  You can see there 3 basic elements in very complex programs.

Of course there are data structure and object oriented approach plus other features to programming for the complex programs but we can use these 3 basic building blocks to start.  We got to start somewhere.

So: Happy ProgrammingImage result for Happy face


  1. Superb i really enjoyed very much with this article here. Really its a amazing article i had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent
    article.thank you for sharing such a great blog with us. expecting for your updation.
    Digital Marketing Company in Chennai

  2. Thank you for sharing this informative article. I hope this will help the App Developers in Kenya to make programming simple.

  3. This is just the kind of information that I had been looking for a long time. Thank you very much for posting this blog its very nice.Please contact us for Oracle Fusion Cloud Financials Training details in our Erptree Training Institute


  4. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.

    python Training in Bangalore | python Training in Bangalore

  5. A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
    Oracle Fusion Financials Online Training
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training

  6. Do you understand there's a 12 word phrase you can say to your partner... that will induce deep emotions of love and impulsive appeal to you buried inside his heart?

    That's because deep inside these 12 words is a "secret signal" that triggers a man's instinct to love, adore and care for you with his entire heart...

    12 Words That Trigger A Man's Love Instinct

    This instinct is so hardwired into a man's brain that it will make him try harder than ever before to take care of you.

    As a matter of fact, triggering this dominant instinct is so mandatory to getting the best ever relationship with your man that the instance you send your man a "Secret Signal"...

    ...You'll immediately find him expose his heart and mind for you in a way he's never expressed before and he will identify you as the one and only woman in the galaxy who has ever truly appealed to him.

  7. I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this Salesforce Training who are providing certification and job assistance. Salesforce CRM certification in Gurgaon

  8. Useful posts, I really appreciate your writing skills and your hard work. You are providing such deep information, that's why I would love to see more blogs about this subject. I am inspired by you and I am also writing about the Canada work visa . Please review it.

  9. I really like the blog and I hope people will have a new blog, thanks for the blog

  10. Having read your article. I appreciate you are taking the time and the effort for putting this useful information together.