Let's have some questions to help you expedite the learning that matters:
2. What is functional programming?
Functional programming results in modules which include mathematical functions and doesn't make use of state & mutable data.
Lisp (Introduced in 1958) was the first language to enable functional programming. It heavily influenced by lambda calculus.
Examples of FT-based languages:
3. Explain the difference between classical inheritance vs. prototypal inheritance?
Instances instantiate from the classes (similar to a blueprint — an overview of the class) and produce both he sub-class relationships as well as the hierarchical class taxonomies.
Instances typically come out of the constructor functions using the 'new' keyword whereas the Class inheritance can or can't use the 'class' keyword in JS.
Instances can also inherit from other objects. They are the results of the factory functions or 'Object.create()'.
4. Explain the difference between functional programming vs. object-oriented programming?
a. OOP is easy to understand and use an imperative style instead of a declarative one. It reads like a bunch of instructions for the system to follow.
b. It (OOP) typically depends on the standard state. Objects and behaviors act together on the same entity. It could be random by any number of functions with non-deterministic sequence and lead to an undefined outcome like the race conditions.
a. FT avoid any common state or side-effects and reduces the possibility of bugs coming of functions emanating for the same resources.
The point-free style allows functions to work in a simplified way and results in reusable code as compared to OOP.
b. FP prefers declarative as well as denotational styles. It focuses on what to do, shifting the underlying functions to take care.
Such practices lead to refactoring and performance optimization opportunities.
5. When is prototypal inheritance an appropriate choice?
Delegation (i.e., the prototype chain).
Concatenative (i.e. mixins, `Object.assign()`).
Functional (It's not functional programming. A function used to create a closure for private state/encapsulation).
Each kind of prototypal inheritance gets its own set of use-cases, but all of them are equally handy in their capability to enable composition.
6. What does “favor object composition over class inheritance” represents?
It is a quote from “Design Patterns: Elements of Reusable Object-Oriented Software.” It represents that the code reuse should be accomplished by assembling smaller units of functionality into new objects rather than inheriting from the classes and generating object taxonomies.
In another way, try can-do, has-a, or uses-a relationships rather than the is-a relationships.
7. What is two-way data binding vs. one-way data flow?
Two-way data binding means that UI fields are bound to model data dynamically such that when a UI field gets modified, the model data also changes with it and vice-versa.
A one-way data flow represents that the model is the sole source of truth. Changes in the UI model push messages that signal user intent to the model (or “store” in React). Only the model has access to change the app’s state. The impact is that data always flows in one direction, which makes it easier to understand.
8. What is monolithic architecture?
A monolithic architecture represents that your app gets written as one cohesive unit of code whose components gets designed to act together, sharing the same memory space and resources.
9. What is microservice architecture?
A microservice architecture represents that your app uses lots of smaller, independent applications capable of executing in their individual memory and scaling independently from each other across potentially many separate machines.
10. Explain the diff between monolithic vs. microservice architectures?
a. The primary advantage of the monolithic architecture is that most apps typically have a large number of cross-cutting matters, such as logging, rate limiting, and security features such audit trails and DOS protection.
b. Monolithic app services conduce to get tightly coupled and entangled as the application evolves, making it difficult to isolate functions for purposes such as independent scaling or code maintainability.
a. Microservice architectures are typically better adjusted, since each microservice has a particular job, and is not concerned with the roles of other components. Decoupled services are also more straightforward to recompose and reconfigure to serve the purposes of different apps (e.g., hosting both the web clients and public API).
They can also have performance improvements depending on how they’re organized because it’s possible to isolate hot services and scale them outside the rest of the app.
Synchronous programming symbolizes that, barring conditionals and function calls, the code is executed sequentially from top-to-bottom, blocking on long-running jobs such as network calls and disk I/O.
Asynchronous programming proposes that the engine operates in an event loop. When a blocking operation is required, the request is started, and the code keeps running without blocking for the result. When the response is available, an interrupt is discharged, which causes an event handler to be run, where the control flow continues. In this way, one thread can handle many parallel operations.
Created on Jan 19th 2019 07:39. Viewed 288 times.
No comment, be the first to comment.