A Hundred Days of Code, Day 004 - Class Attributes and Inheritance

Learnt about Class Attributes and Inheritance, today. Notes The way we write functions/methods and define classes might look similar, class CrazyTalk(object): and def how_now_brown_cow(): The way they behave/execute, though is wildly different. Classes run / spring to life as soon as the program launches. Functions don’t, unless they are called. Realised that objects are containers. What you can do with the object depends on what is in it. Does it hold a dictionary with various methods to modify it? Does it just hold a bunch of text? Reminds me of media formats as containers. A mp4 file is not just an mp4 file. The video resolution could vary from one file to another. The type of audio encoding could be different. It could carry multiple streams of audio or video or other metadata. What you can do with the file or where you can play it, depends on what is inside it. Same with classes and objects. ...

July 11, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 003 - Methods

Learnt about methods today. Notes follow … My understanding about methods? They are functions in classes that help me manipulate the data the objects contain when they are created. I have been using something them subconsciously all along. The __init__ method, that is called/run automatically every time an object is created. Aha A nice way to unpack the .notation i use Let’s say I have a class SquareNumbers that has a function (method) ­— x2 — that will, you know, square a number. And then I create an object f with a number and call the square method on it. ...

July 10, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 002 - Basic Exercises

Did a few exercises today. They were simple. Create a few classes, change them, modify them, use a list as an attribute and so on. In a couple of ways, this was just what I needed. One, I had an extremely busy day at work, and so I did not have the brain power to do anything complex, so I needed the bar really low any way. And two, I’ve realised, that I have always tried to just read a book and then leap mountains. I don’t know why. I must be a sucker for pain. And then when stuff does not work, I sulk and get frustrated. Easing into hard topics like this, makes it more enjoyable for me and I learn better. This is a meta skill, I should remember to use. Come to think of it, everything I have learnt recently, actually learnt, has been this way. I learnt Dvorak and touch typing, slowly, key by single key. I learnt to diet and lose weight, by tens of grammes in the beginning. ...

July 9, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 001 - Beginning With Classes

Notes I’ve taken from the videos I watched, today. This is my attempt at Feynman-ing (below), what I learnt so far. Classes and Object Oriented Programming started to come together for me, when I saw Kushal using them. To use my father’s carpentry analogy, I could in theory just hammer nails into wood to join them. But to make a really strong joint, I could use other methods. I could screw pieces of wood together, which is markedly better than just nailing them. I could chisel wood and create a dovetail or mortise joint. ...

July 8, 2020 · Mario Jason Braganza

A Hundred Days of Code, Day 000 - Begin Again

How do I begin this post? By simply beginning :) Again! This probably is the fourth (or is it fifth) time, I’ll be attempting to learn how to program. And probably the same number of attempts at #100DaysOfCode. I did 47 days last time and 37 days before that. I will try my utmost to go the distance this time. Because even if I didn’t complete a full run, I still learnt tonnes from all my previous efforts. I do have a beginner’s grasp of Python. And I hope get even better, much better, this time. ...

July 8, 2020 · Mario Jason Braganza

Hiatus!

Lost a friend to the virus last night. And a shit-ton of personal issues have cropped up at the same time. Need to go handle and process all of this. Will be back, when I am back.

June 18, 2020 · Mario Jason Braganza