reading-notes

This Repo required for Asac labs class 2


Project maintained by ManarAbdelkarim Hosted on GitHub Pages — Theme by mattgraham

Readings: Testing and Modules

Unit tests:

Unit tests are some pieces of code to exercise the input, the output and the behaviour of your code. You can write them anytime you want.our code will be more reliable: after a change you can run your tests and be in peace

TDD :

Test-Driven Development is a strategy to think (and write!) tests first. More than any checking, we need to think about our software design first.

Unit testing Cycle


Modular programming:

Modular programming is the process of breaking a large, unwieldy programming task into separate, smaller, more manageable subtasks or modules.

advantages to modularizing:


Recursion

What is Recursion?

The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. Using recursive algorithm, certain problems can be solved quite easily.

Why Use Recursion?

Most programming problems are solvable without recursion. So, strictly speaking, recursion usually isn’t necessary.

However, some situations particularly lend themselves to a self-referential definition—for example, the definition of ancestors shown above. If you were devising an algorithm to handle such a case programmatically, a recursive solution would likely be cleaner and more concise.

How a particular problem is solved using recursion?

The idea is to represent a problem in terms of one or more smaller problems, and add one or more base conditions that stop the recursion. For example, we compute factorial n if we know factorial of (n-1). The base case for factorial would be n = 0. We return 1 when n = 0.