reading-notes

Class 2

Back to home page

In Tests We Trust - TDD with Python

Test driven development (or TDD) is the topic of this article, and it goes over how starting test driven development can be scary, but is a useful and rewarding skill to know! The blog gives an example of using the Genderize api to sort people with certain names and assign them a gender based on their name. The idea behind test TDD is the idea of adding and testing code before implimenting the feature, so instead of making a crazy complex function or multiple functions that all fail and break at the end, you test out every new piece of code to make sure it works as intended. Usally tdd is broken down into 3 steps -

This cycle continues for the rest of your app, and the basic process looks like writing a test, making the test pass, and refactoring to make the code look pretty.

If name equals main

From what i can understand, the basic idea of name main is whatever module is being used to start the app, that module takes on the name of main. If a module is being imported, then it takes on the name of the modules name. A module is a file that containes python code and has a file path of .py.

Recursion

Recursion is the act of a function calling on itself multiple times to solve smaller problems. This process is very useful for making our code easier to read and understand. From my understanding and similar to a loop, this process of recursion is used so a function can call itself to loop through data to reach a desired result.

Bookmark and review

Things I want to know more about

Im having a tough time wrapping my head around recursion, how common will this be in our labs/used in our labs? What is a common use of recursion and when should I identify when yo use it?