nguyenlan13.github.io


Redux Thunk

Thunk is a higher-order function that returns a new function. It is a Redux middleware used to allow asynchronous actions to return a function instead of an action, this can be done through writing action creators. These action creators allow the dispatch of an action to be delayed or to dispatch only if a certain condition is met. An example of an asynchronous function is below:


Active Record Associations

Rails Active Record is a library that provides methods for object relational mapping. Object relational mapping, or associations are connections between models and their database entries. Active record provides the six types of associations below:


Model View Controller

The MVC design pattern is popular for building web applications. Ruby on Rails utilizes this framework for rapid web development. This design pattern provides a clear separation of concerns between the logic, frontend, and the communication between the two. The model holds all the logic, the views contain the forms and HTML/CSS, and the controller contains the code to interact between the two.


Bits and Bytes

Computers run on binary, that is, ones and zeroes. This counting system utilizes a base of 2. Computers read binary in a way similar to switches, only allowing it to be on or off, true or false. Building with binary is done with stringing together eight digits, or bits to create a byte. A byte is a unit of computer memory. One byte can represent 256 different combinations (two to the power of eight). Two bytes would be two to the power of sixteen, or 65,536 combinations. Bits are the building blocks of bytes and computer speed is dependent on how many bits are read at once. For example, an 8-bit machine means 8 bits are processed at a time.


Merge Sort

The Merge sort algorithm works by utilizing a divide and conquer approach. The list of elements is divided in half and each subsequent sublist is then divided again. This continues until each list contains just one element. The lists are then put back together by comparing each element and placing the smallest element on front, sorting them.