Monthly Archives: July 2014

Self learning – Is it worth the efforts?

Self learning implies reading and doing it yourself. Not waiting for being spoon-fed and trying your best to teach yourself. Formally it is called Autodidacticism, which I came to know at the time of writing, honestly. In this age of globalization, where majority of the basic resources are available to a large section of the society, people can go to schools and colleges for little price (at least in some countries), not many give a thought to self learning. So, I thought, lets see what I can bring up on this topic today.

Self learning is something that needs to be taught to every kid when he’s growing up. It is not just beneficial to him during academics, but also changes his attitude towards different stuff he encounters. It fills him with a feeling of ‘if anybody else can, why can’t I?’ attitude whenever he sees something hard ahead of him. It lessens the required resources for him to learn something new. For example, learning a new programming language, while some might need special coaching classes and notes, a self learner would only require a book or an Internet connection to read up all the stuff and practice. That’s the clear benefit of it. He stops being a cry baby and takes life head on.

I have argued with people over this from long. A thing which I have heard in nearly all the arguments is the ‘time’ factor. People think self learning is time consuming. Indeed it is. You require time to grasp something and to master it, don’t you? Now, join a coaching class for the same. Will you learn it in a day? Talking about crash courses, those ‘learn this in one week‘ thingy? Do you seriously believe that the stuff on which people spend their lives to master, can be mastered in a week, just because they are charging ‘way too much‘? No you can’t. After a week, you will have like tiny bits of knowledge, enough to convince others that you know the stuff, and probably even a shiny framed certificate, that proves you know the thing. It is good for the show-off types. But if you were planning to make something out of it, then you would be disappointed, because the moment you start with something on your own, you will realize that just knowing theoretically is not enough. You need to know trouble shooting, maintenance and behavior of that particular thing. Because you won’t appoint someone to drive your brand new AMG who has just got his driving license. Right?

When I say self learned, there are two groups of people that come to my  mind. First are those who are pure self learned. They never went to any formal school and succeeded in life. Yes, success is important. But more important is the scale on which you equate success. Success doesn’t necessarily mean making billions from scratch, although it surely is one of the examples. Success is an abstract term. Success, more generally means being able to do what you always wanted to, and being contented. We have famous people who worked for science and arts and were self learned. Thomas Edison, Wright Brothers, Michael Faraday and Rabindranath Tagore to name a few of my favorites. They never walked on the steps of any school, but we know what they did. Could they do the same after joining a school or college? I think not. Not in the present situation, where a fixed curriculum is followed by teachers, which is to be followed by students, no matter who understands what. An exam at the end, after which you are free to forget what you learned because that was what you learned it for in the first place.

The second group of people, who come to my mind are those who technically went to a school and some college, but what they did was completely because of their own hardships and work, and their education had not much to do with it. Consider the example of Steve Jobs, the ‘Apple Computers‘ guy, who had been to school. He was good with studies and even enrolled into a college, but dropped out six months later as his parents were not able to pay his college fees. He later went on to create a company (actually, more than one) known for its standards and he is often called one of the best marketers of all time. This is a dead solid proof, that you don’t need an MBA to know how to do business and be successful in it. Warren Buffett and Bill Gates are no different. They spent an awful time during their childhood, got the practical experience needed to do things, and they are where we see them now. So, again the question pops up. Should you leave getting formal education and go ahead, learning what you like, all by yourself?

It is a quite risky path. You never know if you will click. There is always a possibility of failing miserably. Even if you are skilled and talented, why would the world believe you? You don’t have a certificate right? How will you convince others you know that thing? Demonstrations? The world is too busy for that. Then there are people who have heavy expectations from you. They depend on you. It becomes real hard to take decisions when you have to think not only about yourself, but also about the people who are calling on you. Now having said that, it is still finally on you. You can’t just live according to others. Because if you fail living the way you want, you don’t feel bad, as you would if you fail living according to the rules of others, right?

Ok, lets see the brighter side. You go to school. You go to college. Suppose you are interested in Astronomy. You have a subject on it in your college. Rest all the subjects are of the none of your business type. Still you have to learn them to clear your examination. If you were self learned, you study what you want to, and you can concentrate entirely on your passion. Honestly, life is short. You never know if you will be there to see the next sun rise. So why spend it on something you aren’t even interested in. I totally agree basic knowledge of the world is essential. Yes, primary schooling is something that should be given to every individual, as it not only builds knowledge but also the child’s logic and understanding of the world around him. But at a stage, everyone needs to be given the choice of continuing life according to his or her way, rather then making him or her follow others and lead to a boring, monotonous life. Feels like a crime to me. Indeed some need schooling, no doubt, but it is bad to make it a standard. To make it a rule to live respectfully on this planet.

That is the way I feel. Learn formally till you get to your senses, and then you can do whatever the hell you feel like. It makes you confident about yourself and you start thinking independently, no handles required. You know when and where to look for help and that means you never stop on a jerk in the road to success. Most importantly, self learning is rewarding. It is such a good feeling when you set goals for yourself and attain them. You keep raising the bar for yourself and get to it. There is no fear of ending up last in the class or below your fellow mates. You are your only competition, and that’s when you will realize, you have left the world far behind. You got no certificates, but you can argue, and defeat anyone in it, who has spend $20,000 a year to get that crappy piece of paper which certifies his level of skills and usefulness. Thats the magic of self learning. No boundaries, no limits.

and in case you were wondering, I am not self learned. I go to college to learn what they have to teach me, and I really regret not being able to be a self learner, although I am trying hard to be one. I take as little help as possible, work my ass off trying to figure out concepts in my books. Because once I get it, the feeling is rewarding; and I love it.

Thank you for reading.

Object Oriented Programming: Concepts and explaination using Python

Object oriented programming or OOP is a new concept for me. Till now, all I had done was C and some scripting languages. All of them were ‘procedural’ type of languages. I knew nothing about OOP, and I really hate knowing nothing about anything. So I decided to try it out. I could learn or start with C++ or Java, but I choose Python. The reason being its flexibility and more importantly, it is a language of choice when it comes to creating simple utilities and exploits, which is a field of interest of mine.

So it went good. I studied Python, both in procedural and object oriented way. I am still a beginner in Python but I studied the OOP concepts well. Then my college started and I had a subject called OOPM which deals with the same OOP stuff plus Java. The teacher, who teaches us the subject, I don’t really know what is wrong with her, but her examples are only confined to banks and ATM machines. That is pretty funny and annoying. One example is good, two are Okay, but when someone goes on like a week entirely on the same examples to teach something like OOP, your brain dies.

I have attended all the lectures and I am still trying to figure out what exactly she teaches during the lecture. Just a reminder, I have recently finished with OOP concepts in Python, so it shouldn’t have to that hard. Then I can only imagine the state of all those who are actually doing it for the first time.

Sick of it, I am writing this post on OOP concepts and will try my best to keep the terms and explanation simple and practical.

Starting with Object Oriented Programming 

OOP, as the name suggests is Object Oriented. Meaning that objects are the significant em…objects in it. But what exactly are objects? I wont answer it right away, because it would require some understanding. For now, everything, from variables to functions and else, are objects. First we will see some of the terms used.

Class

A class is like a code-template for creating objects of similar types which have some dissimilarities. For example, If I had to classify the Animal Kingdom again, I would create a class called animals which will be the parent class.

    class Animals(object):
        pass
       
    dog = Animals()
    dog.legs = 4
   
    cat = Animals()
    cat.legs = 2

And to use the class, we simply create an instance of it, which can be called an object as well. Dog and Cat are the instances here, for example. Since the class is empty (see the ‘pass’). We can set attributes to the instances. ‘legs’ is an attribute to the object dog and cat, which are instances

Object

Objects are all around you. Take a look. Everything that can have an individual significance can be considered an object. All objects have two characteristics, state (like color, size) and behavior (like tasks it does, eating, sleeping). In programming, objects are much similar to that. They have state (which are variables) and they have behavior (which is through methods). In the above ‘class’ example, cat and dog are objects. Let me write something that will make it clear.

    class Foobar(object):
        def __init__(self):
            self.x = x
            self.y = y
       
        def area(self, x, y):
            return x * y
           
    rectangle1 = Foobar()
    area = rectangle1.area(4,6)

So rectangle1 is the object I created. I use the method area to find out area of the supplied rectangle.

Inheritance

Inheritance is using an existing class and creating a new class which inherits, or has all the features of the old class plus some new features. So, if one were to organize reptiles and cats separately, he could do this.

    class Reptile(Animals):
        pass
       
    class cat(Animals):
        pass

This creates classes which can be called daughter classes of parent class Animals. They inherit all the properties of Animals plus they can have their own new properties. It results in code reuse, but read any good book and they will tell you why you should avoid inheritance. Since this is not a guide, I wont.

Methods

When you write a function inside a class, it is called a method. Why? I don’t know. Some books I have read insisted on calling them functions, while some didn’t. Its upto you. For the sake of an example, I will write a class ‘Shape’ and daughter classes and methods in them for finding their respective areas.

    import math

    class Shapes(object):
        pass
       
    class Circle(Shapes):
        def area(self, radius):
            return radius * radius * math.pi
           
    class Triangle(Shapes):
        def area(self, base, height):
            return 0.5 * base * height

The ‘area’ function in both the classes calculates the area of that particular shape and returns it. You need to call the function with parameters. For example,

    import math

    class Shapes(object):
        pass
      
    class Circle(Shapes):
        def area(self, radius):
            return radius * radius * math.pi
          
    class Triangle(Shapes):
        def area(self, base, height):
            return 0.5 * base * height
          
    mytriangle = Triangle() # Creating an instance
    area_of_triangle = mytriangle.area(5,10) # 5, 10 are arguments

If you are wondering, the first parameter ‘self’ is the object itself.

So that was my brief scattered explanation on OOP concepts. I am pretty sure there are some mistakes in the above snippets of code. Please let me and others know the mistakes so I can correct them.