reading-notes

Readings: Game of Greed 1

How to use Random Module

Dictionary:

What is Risk Analysis

The probability of any unwanted incident is defined as Risk. In Software Testing, risk analysis is the process of identifying the risks in applications or software that you built and prioritizing them to test. After that, the process of assigning the level of risk is done. The categorization of the risks takes place, hence, the impact of the risk is calculated.

Why use Risk Analysis?

Risk analysis allows you to identify risks to your software and other software prior to build/implementation. When a test plan has been created, risks involved in testing the product are to be taken into consideration along with the possibility of the damage they may cause to your software along with solutions.

Possible risks might include:

Certain Risks are unavoidable:

Steps to follow:

Magnitude Indicators Explained:

Risk Identification:

Risk assessment

Risk Assessment Example

The perspective of Risk Assessment:

How to perform Risk Analysis?

Steps to perform risk analysis:

Big O Notation (Video)

If you have two differnt steps in your algorithm, you need to add up these steps.

O(n) means that the time is derived from the size of the input data.

4 keys to keep in mind when calculating Big-O:

Python Random

The functions supplied by this module are actually bound methods of a hidden instance of the random.Random class. You can instantiate your own instances of Random to get generators that don’t share state.

Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the random(), seed(), getstate(), and setstate() methods. Optionally, a new generator can supply a getrandbits() method — this allows randrange() to produce selections over an arbitrarily large range.

The random module also provides the SystemRandom class which uses the system function os.urandom() to generate random numbers from sources provided by the operating system.

Bookkeeping functions

Functions for bytes

Functions for integers

Functions for sequences

Real-valued distributions

The end-point value b may or may not be included in the range depending on floating-point rounding in the equation a + (b-a) * random().

Alternative Generator

Notes on Reproducibility

Sometimes it is useful to be able to reproduce the sequences given by a pseudo-random number generator. By re-using a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running.

Most of the random module’s algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change:

What is Dependency Injection

In software engineering, dependency injection is a technique whereby one object (or static method) supplies the dependencies of another object. A dependency is an object that can be used (a service).

When class A uses some functionality of class B, then its said that class A has a dependency of class B.

Transferring the task of creating the object to someone else and directly using the dependency is called dependency injection.

Dependency Injection Cartoon

Why should I use dependency injection?

Let’s say we have a car class which contains various objects such as wheels, engine, etc.

Here the car class is responsible for creating all the dependency objects. Now, what if we decide to ditch MRFWheels in the future and want to use Yokohama Wheels?

We will need to recreate the car object with a new Yokohama dependency. But when using dependency injection (DI), we can change the Wheels at runtime (because dependencies can be injected at runtime rather than at compile time).

You can think of DI as the middleman in our code who does all the work of creating the preferred wheels object and providing it to the Car class.

It makes our Car class independent from creating the objects of Wheels, Battery, etc.

There are basically three types of dependency injection:

Now its the dependency injection’s responsibility to:

Benefits of using DI

Reference Material: (Libraries and Frameworks that implement DI)