Nairobi, Kenya +254 112640369 info@mobitechsolution.co.ke

Self Taught Programmer

Our Blog Learn Programming

Being a self-taught programmer doesn't mean not to go any school or do not follow any instructor but what it simply means is that when you don't wait for someone to take initiatives on behalf of yourself and get ready to excel the programming skills by any kind of means

Self taught Programmer

The Self-taught Advantage

Learning how to program outside of school is increasingly common. A 2015 Stack Overflow (an online community of programmers) survey found 48 percent of respondents did not have a degree in computer science 10 . When I was hired at eBay, I was on a team that included programmers with CS degrees from Stanford, Cal and Duke, as well as two Physics PhD’s. At 25, it was intimidating to realize that my 21-year-old teammates knew 10 times more about programming and computer science than I did. As intimidating as it might be to work with people who have bachelor’s, master’s and PhD’s in Computer Science, never forget you have what I like to call the “self-taught advantage .” You are not reading this book because a teacher assigned it to you, you are reading it because you have a desire to learn, and wanting to learn is the biggest advantage you can have.

What is Programming

Programming is writing instructions for a computer to execute. The instructions might tell the computer to print Hello, World! , scrape data from the internet or read the contents of a file and save them to a database. These instructions are called code . Programmers write code in many different programming languages. In the past, programming was much harder, as programmers were forced to use cryptic, low-level programming languages like assembly language . When a programming language is lowlevel it is closer to being written in binary (0s and 1s) than a high-level programming language (a programming language that reads more like English), and thus is harder to understand. Here is an example of a simple program written in an assembly language.

What is Python

Python is an open-source programming language created by Dutch programmer Guido van Rossum and named after the British sketch comedy group, Monty Python’s Flying Circus . One of van Rossum’s key insights was that programmers spend more time reading code than writing it, so he created an easy-to-read language. Python is one of the most popular and easiest to learn programming languages in the world. It runs on all the major operating systems and computers and is used in everything from building web servers to creating desktop applications. Because of its popularity, there is a large demand for Python programmers.

Writing Good Tests

Good tests are repeatable. That means when you run your tests , they should work in any environment—if you write a test on OS X, it should also work on Windows without having to make any changes to to the test. An example of violating this would be including hard coded directory paths in your test. Windows and OS X use different slashes for directory paths—so your test in a Windows environment would not work in an OS X environment. This means the test is not repeatable, and needs to be rewritten. Tests should also run quickly. Tests need to run often; try not to write tests that take a long time to run. Finally your tests should be orthogonal—one test should not affect the other.

Object-oriented Programming

The object-oriented programming paradigm involves writing programs where you define and create objects that interact with each other. We’ve been programming with objects this whole time—strings, integers and floats are all examples of objects. But you can also define your own objects using classes. Classes are the blueprint used to create objects. You can think of a class as the idea of an object. Think of an orange. An orange is an object. A fruit weighing between 2 to 10 ounces is the idea of an orange—a class. We can model oranges in Python by defining a class we can use to create orange objects. We define a class using the class keyword followed by the name we want to give our class. A class is a compound statement with a header followed by suites. You write suites after the header, which can be simple statements, as well as compound statements called methods. Methods are like functions, but they are defined inside of a class, and can only be called on the object the class can create. We saw different examples of this in Chapter 5 when we called various methods on strings. Here is an example how we can represent an orange using a class in Python: Object Oriented programming class Orange : print ( "Orange created!" ) We started with the class keyword followed by the name of our class—in this case Orange because we are modeling oranges. By convention, classes in Python always start with a capital letter and are written in camelCase—which means if a class name is made up of more than one word, the words should not be separated by an underscore (like a function name), instead each word should be capitalized LikeThis. After our class definition we have a simple statement— print(“Orange created!”) . This code will execute when we create an orange object. With this class definition, we can create as many Orange objects as we’d like: orange = Orange() print ( type (orange) ) print (orange ) >> Orange created! >> >> <__main__.Orange object at 0x101a787b8> We created a new Orange object using the same syntax we use to call a function—[ classname]() . This is called instantiating an object, which means creating a new object. “Orange created!” prints as soon as we instantiate our Orange object. When we print type(orange) , the type function tells us our Orange object is an instance of the Orange class we just created. When we print our Orange object, Python lets us know it is an Orange object, and then gives us its location in memory. When you print an object like this, the location in memory printed on your computer will not be the same as the example, because the object’s location in memory changes each time the program runs. Now we are going to add a method to our Orange class. You define a method with the same syntax as a function. There are only two differences: a method must be defined as a suite in a class, and a method has to accept at least one parameter (except in special cases I won’t go into). You can name the first parameter of a method whatever you’d like, but by convention the first parameter in a method is always named self , and I’ve never seen this convention broken.

© Mobitech Solution. All Rights Reserved. Designed by Mobitech Solution