Month 3, Higher-Level Programming
Working with Python on a daily basis, building out advanced data structures in C—"Demanding" sums up the experience of the fourth month at ALX.
After a much anticipated two weeks break after completing the milestone shell project, Month 3 started out with an introduction to a new programming language, Python. This month, we were mainly drilled on learning Python and using it to solve tasks, while building and working with advanced data structures; i.e, doubly-linked list, stacks and hash tables, in C.
TL;DR: Used Python for most of the month to solve problems. Started with the fundamentals of Python, to more advanced concepts like Object-Oriented Programming (OOP) and Exceptions (try-except blocks) in Python code. Also built more data structures (doubly-linked lists, stacks, queues, hash maps/tables) in C, learning how to use them and the scenarios in which they will be preferred.
Overview for the month
Month 3 started out with an introduction to Python, who the creator of the language was, and getting to understand the Zen of Python. Then we moved on to fundamentals which involved variables, indentation, if/else blocks, iteration (or in simpler terms, looping) and importing modules from either the standard Python libraries or from personal code in the filesystem.
After going through the fundamentals of the language alongside using Python to solve our daily tasks, we were introduced to lists and tuples in Python alongside list operations (arrays are referred to as "lists" in Python, fancy language right?) This was a major topic because it involved a lot of new syntax (range, enumerate, looping through lists in Python), and it also had this really fancy concept called list comprehension. List comprehension has turned out to be my favourite way of using lists in most code I write, really fun stuff.
Like clockwork😭, our next projects were on using C to build dynamic libraries, before learning how to use Stacks and Queues as data structures to solve programming tasks (also learnt more on the LIFO and FIFO concepts which is what a Stack and a Queue are built on respectively).
Worked with handling exceptions in a Python program through try/except blocks (was quite fun to learn), and ended the month with some Object-Oriented Programming, which majorly involved using objects (which are built by classes) for most computations in your source code rather than using functions or the common "procedural programming" model.
PS: Before the Holiday Break at ALX, we were introduced to hash tables (popularly known as Hash Maps); how to build them, how to interact with them, and the situations in which using a hash map would be preferred over other data structures. At the moment, I am still going through a lot of research regarding this topic, and I hope that by the next review I will have a better understanding of how to use Hash Tables (and hash functions) to solve tasks through code.
Key Concepts Learnt
Python; Fundamentals and Using It To Solve Tasks
Though I have some experience with using Python, this was a much more indepth study on how to use the programming language.
Variables, Indentation (curly braces do not serve as a way of defining code blocks here), if/else statements, functions, and knowing how to import modules.
Learnt on using Sets and Dictionaries as data structures in Python; how to create them, go through them, and common (and some uncommon) operations you can perform on both data structures.
Handling Exceptions in a Python Program
The C programming language does not provide direct support for error handling, so imagine my surprise when I realised I could plan for errors using Python and write code that runs depending on any error I specify for it to watch out for.
Started out with learning about try/except blocks and how the syntax worked.
Learnt more on the different types of errors that can occur in a Python Program, and the common ways in which these errors occur. And of course, how to handle specific error(s) through the
except
keyword.Also learnt how to use the
finally
keyword to make sure that a block of code runs regardless of what happens in thetry/except
blocks.
Object-Oriented Programming in Python
Started out with understanding what OOP (codename for Object-Oriented Programming) does differently compared to other programming models.
Learnt on how to use classes to create a blueprint of how an object should look like. Also got to know about the different structures in a class; most importantly, class methods and class attributes.
The
__init__
method in classes, alongside theself
parameter. Public, protected and private attributes in a class and how to use them.Wrote getter and setter methods for private attributes in the class, which helps to ensure data encapsulation and to avoid direct access of a private attribute in the class.
More Advanced Data Structures in C
Worked on understanding the LIFO and FIFO concepts. This information was important in getting to understand how some data structures work.
Learnt on how to build a stack and a queue, when to use them, and how to use them.
Built a program solving a common use case in which a Stack data structure performs better than other data structures. This was done by building an interpreter for Monty Bytecode files.
Started out with learning about Hash Tables and Hash Functions (still not confident in my knowledge of using hash tables as of now, working on it tho.)
Summary
This month has been the most demanding and tasking month for me at ALX, and that makes me a bit scared for the months to come. As I proceed into the next month of the program (and into the new year generally), a main priority is to build better systems and routines that will help me work on my courses better. I know that I have not been quite optimal in the way I do things, and I hope this will help me get some positive results as early as possible (experimenting on routines already, maybe I'll stumble upon a stable one by February max?)
Anyways, that marks an end to this month's review. Thank you so much for going through it, and I hope this one was (slightly?) better than the previous review for November. Your thoughts and feedback are always appreciated; share them in the comments.
So yea, sayōnara, ciao, [insert goodbye in your native language here], byee🫶🏾