Test Driven Development - abukhalil-LTUC-ASAC/amman-401d4 GitHub Wiki

TDD and its implications

Might look tedious at first impression, but it cant be overstated on its importance, especially while working on big projects where you'd be expected to have some I/O action without knowing the whole code base. Or when you would develop alone, knowing some expected behaviors and build accordingly. A good bug killer if you ask me for both scenarios.

And sometimes, TDD could spell ruin due to its difficulty. Tests done after projects were built is even much harder than at its very beginnings. Do complement the why's to do TDD with the Why not's.

What have we learned?

some functions while testings require pre made constants or executing certain initial states, using beforeEach helps to do so. Before executing other tests some result also needs clearing and resetting, so afterEach is used.

ES6 gave us the chance to implement proper OOP concepts that are widely used in other languages, these help minimize reusable code or by simply making it much more readable, think android JAVA development and how neat OOP is in that. Inheritance is straight forward and every method, variable and statics are contained in a neat bracket of the class instead of prototypes all around.

Static methods are a boon, they allow for global level variables and methods that are not bound to an instance but rather to the class and can be called through it.

Higher order functions such as map use multiple inner functions concurrently, namely index moving loop and replace functions with the specific operation. Time is cut short when common used functions are usually used together and be made into a single phrase call.

Phrases so far include

  • functional programming
  • pure function of which functional programming utilizes, has a bunch of specifications to be followed such as immutable input and predictable output.
  • immutable state is when variable are defined with const and are not changed throughout the code.
  • super is used in OOP when you'd use the extended class i.e. parent of a class to use its constructor and methods.
  • inheritance is when you'd extend a class to another and make use of all its methods/properties without rewriting them.
  • instance is a reference to an object, and in JS is an object itself, the process is called instantiate.
  • context refers to the object in scope of the function referred by this.
  • Jest is our beautiful framework that holds all what we could use to do proper TDD.
  • Continuous Integration (CI) is when code of all developers are being integrated on demand into the project, mostly using automatic tools such as git, and is usually done incrementally, frequently and on small commits rather than a couple of large commits.
  • unit test has just been practiced by testing each method with pre-defined inputs and expected outputs.