Software Engineering


Patrick's Blog spot

What’s Your Learning Style?

My time at coding bootcamp is coming to an end. As with everything I undertake, this signals a time for me to take stock of my experience, my achievements and “learnings”.


Lifecycle methods in React components

Lifecycle Methods

React lets you define components as classes or functions. Components defined as classes provide more features. Some of these features inlcude methods that are a hook into the lifecycle of a react component. they can be used in ES6 class components, but not in functional stateless components. Each component has several “lifecycle methods” that you can override to run code at particular times in the process. The lifecyle methods are categorized in three main processes: Mounting, Updating and Unmounting.


Asynchronous actions, Promises and Fetch

Working with abstract concepts is often easier when those concepts can be represented by values. In the case of asynchronous actions, you could, instead of arranging for a function to be called at some point in the future, return an object that represents this future event, this is where promises come into play. The term asynchronous refers to two or more objects or events not existing or happening at the same time (or multiple related things happening without waiting for the previous one to complete). A promise is an Asynchronous action that may be completed at some point and produce a value. A Promise is an object that’s returned by a function that has not yet completed its work. The promise literally represents a promise made by the function that it will eventually return a result through the promise object. it is able to notify anyone who is interested when its value is available. When the called function finishes its work asynchronously, a function on the promise object called a resolution (or fulfillment, or completion) handler is called to let the original caller know that the task is complete. When working wit API’s Javascript uses Asynchronous actions coupled with promises and fetch functions to complete network calls while still other work orders to the DOM. The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network


`form_tag` vs. `from_for`, What to expected with `form_with`

form_tag and form_for provide two very similiar interfaces to much of the same thing. Keeping with the DRY principle, repetition is shunned upon and soon form_tag and form_for will be depricated and replaced with with form_with.


Validation, Error Messaging in Sinatra

Sinatra is a Ruby-based application framework used to create web applications. Sinatra offers a broad range of capabilies from writting simple one page applications to complex multi page applications. In the MVC architecture, Sinatra’s validations start with setting validations on your models.