TDD,OOP and their perks

A taste of manna

For software developers Object Oriented Programming is like manna from heaven and the reasons are well known to us.There are many programming languages that use OOP , popular ones are Java,Python,C++, Ruby, Visual Basic and .NET. Though its benefits are many, I have to point out what makes me tick when I think of OOP, its relation to the real world scenarios around us everyday.

Think of something close to you ….**thinking** …. a vehicle for example. So that makes vehicle one of our classes, this means that it will contain the blue print of all its instances (objects). There are so many types of vehicles with similar attributes, which necessitates a need for a Super design from which they can inherit these attributes and behaviors, that is inheritance. These attributes and behaviors can also be implemented differently in each type of vehicle by overriding the behaviors. Other functionalities like encapsulation and abstraction make OOP easy to implement. It encourages re-usability of functions.

Today I was able to create a python project using flask micro-framework and as I was setting up my computer environment, I saw a lot being mentioned about creating a virtual environment and I had to find out more about it. So a virtual environment keeps the dependencies required by different projects in separate places, so this implies that packages installed for one project will not affect the global python installation. It is also important to use a virtual environment because it saves you the task of having to create every file needed to get a whole new python environment by using links to the global environment files.Thats a tonne of disk space saved.

I am currently in a boot-camp session that rely emphasizes on test driven development. TDD is important for agile designs It enables one to think through the requirements and design before writing functional code.I had some challenges understanding how to implement TDD until I came across this function

TDD= Refactoring + TFD

So the process behind this function is that first you need to write a first test. just enough for the test to fail and run the test .When the test fails, write just enough code to make the test pass,(TFD). Then continue making changes to the code and it conforms to your criteria (Refactoring) and repeat the unit tests over time.

The approach leads to good designs, defects are noted earlier however so many tests have to be written,write tests that are too large and the tendency for programmers to forget to run tests frequently.There are so many lessons learnt today.Test driven development is definitely a practice that I am going to keep and develop.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.