You are on page 1of 16

3 Things to Keep in Mind if You

Want to Learn How to Code in 3


Months Instead of 3 Years
Before we start,

Take a look at the following sculptures

Output Tool used

3d printed model of Venus 3d printer

Stone sculpted model of Venus Hammer and chisel set

Above a two similar out products that have been produced with two different approaches
It is simpler and cheaper to use Hammer and chisel method

Hammer and chisel would cost only about N15,000 total

But it is strenuous and takes a lot of time… simple work can take up to 80 hours of active
time. Meanwhile the 3d printer method would only take about 30 minutes of active time

Same applies to coding

In coding, any problem you want to solve can be solved using simpler and cheaper means
too.

But using coding will make it faster and easier to replicate

To explain this point, I’d give a live example at the end of this pdf

But before that, here are 3 things to keep in mind if you want to learn how to code, faster
1
Coding is made up of two parts

There are two parts to writing code;


1. Writing in Language-specific syntax
2. Algorithm

Writing in language-specific syntax;


This implies using a language of choice e.g Python, Java, Javascript, C

Algorithm
This implies knowing the steps required to solve the problem
E.g to add find the sum of two numbers,
you first pick the first number,
then add the second number to it

Note:
If you don’t know how to solve a problem without coding, you won’t be able to solve the
problem WITH coding
2
Look at code like building blocks
Here’s a secret, the same java that is used by american developers who speak english is
the same that is used by chinese developers who speak chinese

There is no chinese version of java

Yet we have superb chinese java developers

The secret is that they look at code as blocks

For example;

Below is a bit of java code for-loop;

for (x = 0; x < 100; x++)


{}

It’s possible to look at it this way;

Blocks view

for start value end condition Value to increment by

Write code to be repeated

Implementation

for x=0 x<100 x++

Print(“hi”);
When you’re coding, you have to look at the programming syntax as blocks

3
Aim-Search-Shoot

This is one of the best ways to write code fast;

Aim search shoot.

But to do this you have to understand point number one, which is that… coding is made up
of two part

1.The language-syntax
2. And the algorithm

So to aim search and shoot;

First, write the problem you’re trying to solve

Second, go to google and search “how to [solve specific problem] in [language of choice]”

Third, edit and copy the solution into your code


BONUS

Ask why the programming language was


created

This is one of the shortcuts to understanding a programming language/ software tool

For example;

Python was created for code readability, The creator wanted a language that was easy to
read

That why python doesn’t require you to use things like curly braces, {}, semicolons, ;, etc

Java was created to be able to run on multiple devices no matter the underlying operating
software… e.g Windows, Linux,

That is why Java frequently calls on the System class, which enables the programmer to
use system resources without having to understand the OS itself

These are minor details that help you learn new programming languages faster
Sample Code
Here’s a short story

Dr. Bolagade gave us an assignment a few weeks ago

The assignment: Submit a computer-readable version of your email address

This meant that we were either to submit


A hex(ascii) version of our email
OR
A binary version of our email
OR
Both

So what’s the hammer-and-chisel method for solving this assignment

Steps;
1. Write down your email address
E.g m4botdev@gmail.com

2. Get an ascii chart online


3. For each letter in your email, find the ascii value on the chart
m,4,b,o,t,d…….

4. Write it down
109- 52- 98- 111- 116………

This is a simple, straight- forward approach

But now imagine you had a very long email address

Like ; mustaphabaruwasemail4work@gamil.com
That’s about 40 characters up there

If I’m to use the manual method, I’d have to look through my ascii chart 40 times!

Or imagine you wanted to do someone’s assignment for them


It begins to get stressful and strenuous

So I decided to solve this with coding

I went back to the manual algorithm;

1. Write down your email address


2. Get an ascii chart online
3. For each letter in your email, find the ascii value on the chart
4. Write it down

Then i edited it a bit to suit a coding algorithm

Start
1. Accept user email address
2. For each letter in email address
3. Find the ascii value
4. Output the values

Note that a computer code already has all the ascii built in so no need to find an external one

So here is what the code will first look like

Code version 1
****************************

//code start

//Accept user email address

//for each letter in email address


//find the ascii value

//output the values

***********************

That is the algorithm

Now I choose to use C programming language for the program

I’d use an online compiler so I don’t have to download anything

Here’s a link to the compiler I used:


https://www.programiz.com/c-programming/online-compiler/

Code version 2

****************************

//code start
#include <stdio.h>

int main() {

//Accept user email address

//for each letter in email address

//find the ascii value

//output the values

***********************

The code I just input is necessary for c programs to work

You can safely think of this as point 2: [Look at code like building blocks]

This is similar to the main method and main class in java language
JAVA

import java.util.Scanner;

public class Main {

public static void main(String[] args) {


C
#include <stdio.h>

int main(){

The point is, you don’t have to memorize the deeper workings…

Just cram it.

Imagine it’s just a building block and move on with your code

Now we’ve solved the first part of our algorithm

Code version 3

****************************

//code start
#include <stdio.h>

int main() {

//Accept user email address


char useremail[30] = "m4botdev@gmail.com";

//for each letter in email address

//find the ascii value

//output the values

***********************

Next is to accept the email address. Which we will accept as a string variable

And in case you don’t remember how to use a string variable in C

Just use the aim-search-shoot method

Aim - Write down the algorithm


//Accept user email address

Search (Google) - How to accept string variable in C


Answer:

Now to edit it for my code use;

Their version: char string_name [string_length] = “string”

My version: char useremail [30] = "m4botdev@gmail.com"

Code version 4

****************************

//code start
#include <stdio.h>

int main() {

//Accept user email address


char useremail[30] = "m4botdev@gmail.com";

//for each letter in email address


//find the ascii value

//output the values

***********************

Now next step is to find the ascii value for each letter in the email address;

Code version 5

****************************

//code start
#include <stdio.h>

int main() {

//Accept user email address


char useremail[30] = "m4botdev@gmail.com";

//for each letter in email address


for (int i = 0; i < strlen(useremail); i++){

//find the ascii value

//output the values

***********************

I have created a for-loop to go through each character in my email address

Code version 6

****************************

//code start
#include <stdio.h>

int main() {
//Accept user email address
char useremail[30] = "m4botdev@gmail.com";

//for each letter in email address


for (int i = 0; i < strlen(useremail); i++){

//find the ascii value


//output the values
printf(" %d-",useremail[i]);

***********************

Finally I used the printf function to find the ascii value and output the values of the code
at the same time

Here’s the final code;


Copy and paste it into online COMPILER:
https://www.programiz.com/c-programming/online-compiler/

#include <stdio.h>

int main() {
//code accepts user input
char useremail[30] = "m4botdev@gmail.com";
//to test code, replace my email above with yours

//loop through the input


printf("Your email in ASCII form is : ");

for (int i = 0; i < strlen(useremail); i++){


//get the ascii code for each character
printf(" %d-",useremail[i]);
}

return 0;
}

Here’s a sample output;

OUTPUT:

Your email in ASCII form is : 109- 52- 98- 111- 116- 100- 101- 118- 64- 103- 109- 97- 105-
108- 46- 99- 111- 109-
Going forward;

The code now outputs the ascii form of your email;

But remember the full assignment;


—----------
The assignment: Submit a computer-readable version of your email address

This meant that we were either to submit


A hex(ascii) version of our email
OR
A binary version of our email
OR
Both
—-------------

So what if we wanted to find the binary version of our email using code

Imagine finding the binary version of up to 20 different characters manually

That will be difficult, but coding can make it easy

So let’s have a little challenge;

Challenge 0.1

1. Copy the final code of our hex finder code above

2. Paste it into the online IDE:


https://www.programiz.com/c-programming/online-compiler/
3. Put your email into the variable space

4. Take a screenshot and post it into the coding group

Complete this challenge and I’d send you the binary finder code

Also I’d like for more software students and enthusiasts to join our community so that more
people can benefit, so I’m adding one more challenge

Challenge 0.2

1. Share the link for the Serial Programmers community to as 3 people you think will be
interested or 3 groups (you can share with as many as possible people)

2. Tell me when you’ve shared the links

3. I’d share a short pdf that shows you how to use the concepts you learned here to
build full software that you can show to software companies or add to your portfolio

Link to Telegram Coding Channel:


https://t.me/serialProgrammers

My email address:
m4botdev@gmail.com

Feel free to ask questions on the coding group.



-Mustapha

You might also like