Write Your First Lines Of Code Without Any Tech Background
By Nabanita De, Founder and CEO of Returnships.org
Returnships.org’s Training module from the free Returnships.org’s course, the upcoming Returnships cohort and Returnships book by Nabanita De, is committed to providing grassroots level skills training to bridge the gap between stay-at-home caregivers and returning to the workforce after a career gap. Learning to code is a basic skill of 2021, with 3.9 million open US tech jobs incorporating starting salaries of 100K with amazing perks like remote work, maternity leave, 401K support, flexible working hours etc., along with no requirement of a college degree. Through writing a few lines of code, you can change the world and make an impact on billions of lives. I built Project Fib, a chrome extension to detect Fake News on the Internet during my grad school at HackPrinceton, which had an organic reach on 1000+ News Articles and 50+ universities worldwide and spearheaded an entire revolution of detection of Fake News Research worldwide.
Most programming languages have the same basic structures (in the form of data structure and algorithms), and vary just in terms of syntaxes, making learning to code in one language, a skill transferable to any coding language. Thus a thorough understanding of coding basics, ability to code these data structures and apply them to real world problems, form the crux of all coding interviews. Let’s jump right in, into coding basics from Returnships.org, to jumpstart your career in tech without any tech background.
- Algorithms – Think of the time you cooked a new recipe. You visualized the dish, curated a list of ingredients, gathered the ingredients/pots/pans in one place and followed step by step procedure to prepare the dish. To delegate this task to a computer, you will need to break down the tasks into granular levels and provide step by step instructions, also known as programs, code or algorithms. The process of writing instructions and delegating to the computer is called coding or programming. Just like in cooking, where you need several items like oil or spices to cook and pots/pans to hold the food, algorithms needs various coding alphabets, grammar and data structures to be written and are as follows:
- Data Types – Data Types are like pots and pans which hold the food (data) being cooked(processed), when you are cooking (writing code). Variable data types are like cups, which can be refilled with different kinds of tea/coffee and cleaned, whereas constant data types are like your birthday – cannot be changed, once declared. Most basic variables in any programming languages may include int (storing numbers without decimals), string (storing letters, words and sentences), char (characters for storing single letter or alphabets), bool (boolean for storing true or false, 0 or 1) and float/double (for storing numbers along with its decimal point). Just like how each baby is named, to be recognized through their lifetime, data types and structures may need to be declared with a name and/or values, to be used later.
- Data Structures – Data Structures are like living organisms, while data types are like organs of the body, when it comes to storage (of data). Just like a lawyer would be summoned for a legal matter vs a real estate agent for buying a property. Each data structure serves different purposes and choosing the right one is necessary to write efficient code.
- Methods/Functions – Methods/Functions are like a recipe, which leverages step by step instructions/code to do a task, identified through its name (like potato curry recipe) & may require ingredients, pots & pans (data types and data structures) as input to cook the dish (give an output). After the dish is cooked, it may or may not be served in a bowl (data returned through a data structure or variable). Just like a company has different job functions, data structures may have their set of methods & functions.
Types of Data Structures
- Arrays – A good parallel to arrays can be hotels. The location of each hotel room (array element), next to each other, stays immovable with overall fixed hotel size, while people in it might change. To visit a person in a hotel room, you will need their room number. Likewise to call an element of an array, you will require where it’s stored in the array – its array index. Unlike your hotel room numbers starting from 1, arrays start from 0, thus the last index referenced is n-1, n being the size of the array. While cleaning the hotel rooms, the cleaners will sequentially check each room to clean, likewise while iterating through array elements, it can be accessed through indexes 0 to n-1.
- List – Lists are like online shopping carts. You can add/delete items/elements to the cart. There is no upper limit as to how many items can be added to the cart. Lists differ from arrays in the way that list’s size can be changed as per convenience.
- Linked List – Linked Lists are like compartment coaches of a train. Each compartment is linked with one another through a train link (pointer). A compartment (element in a Linked List) can be moved around by detaching from previous compartments and reattaching to new compartments. Linked List triumphs in ease of shuffling up sequences of elements and easy deletions.
- Stacks – A good parallel is a stack of plates of the same size, on your kitchen counter, stacked on top of each other. While eating, you pull out the top one first to eat. To get to the bottom plate, you remove each plate from the top to get to it. Stacks operate in last in, first out fashion. They have operations like push (push to the stack), pop (pop top element from stack) and peek (taking a peek at the first element of the stack).
- Queues – Think of your grocery cashier queue. The first person who gets in the queue is first served, followed by second and third. If you are at the end of the line, you are served last and you wait for your turn. Queue operates in first in, first out fashion and has operations like enqueue to add to the queue and dequeue to remove.
- Maps/Hashtable – To follow your friend on social media, you need their unique social media handle. Maps/dictionary/hashtable operate the same way by assigning a list of key value pairs, their key can be something that uniquely identifies the value like their instagram handle. The value could also be another data structure.
- Trees – Think of your family hierarchy tree, your ancestry started from a “root”. Each node in a tree is equivalent to a person, who has a “name” (value) and can have one or many children/parents. The youngest kids in your family tree, with no children are called “leaf” in tree data structure. Just like your family hierarchy tree, in a computer tree data structure, each node in a tree is connected through a parent-child relationship link. A binary tree, as name suggests, has at most 2 children – left child and right child. A variant of binary tree is Binary search tree (BST) Data Structure, where the value in the left child is less than equal to the right child, which makes searching for data easier. Level of a tree is similar to the generation count and is the distance from the root to leaves (current generation) of the tree.
- Graphs – Graphs are similar to social graphs of social media, where each person can have multiple followers, follow multiple people and are interlinked. Unlike trees, each graph node does not necessarily share a parent-child relationship.
Famous Graph Traversal Algorithms
- Breadth First Search – If you need to ask for money or a favor. First you think of all your closest friends to see if they can help you out. If that fails, you explore the list of all your second degree connections or acquaintances. Further when noone in your network could be of help, you started looking through a list of all friends of friends and strangers. Breadth First Search works in a similar fashion of exploring all connections in the same depth and then moving on to next & can be implemented with Queues.
- Depth First Search – Think of all your past relationships. You started with your first partner, got to know them, did events together, and got introduced to friends of friends. When that didn’t work out, you moved on and repeated the cycle of getting to know each other with your new partner. Depth First search is all about traversing through each option “in depth” before moving on to the next and can be implemented with Stacks.
Additionally, Time and Space Complexity are two metrics, often used to measure the effectiveness and efficiency of the chosen Data Structures and Algorithms. Time complexity refers to how long it will take to run the written code. Space Complexity is the space it would take to store the data in the data structure. Both of them are reported in terms of Big O Notations, in terms of n, where n is the size of the input.
If you understand the coding basics a little bit better now, run your first lines of code here and checkout these algorithm resources here and here. Coding skills can only be perfected through practice, check out this hands-on resource. If you get stuck, feel free to seek support and mentors on our Returnships forum here. If you would like some inspiration for projects to code, checkout the list of projects I built over the years, here.
Tell us what you thought about this article on our Facebook, Twitter, LinkedIn and Instagram pages. To connect with our Founder and pitch your story, visit her LinkedIn, Twitter and Instagram.
If you found this article useful, pre-order our Returnships Book By Nabanita De here. To listen to our Returnships podcast, click here.
Currently Returnships.org is empowering caregivers to return to the workforce in 89 countries. Our initiative will only continue through your support in the form of donations. Donate here.