Programming Principles
REST
Roy Fieldings 2000 Thesis on what REST is
S - is the single responsibility principle. Your class should have a single responsibility. O - open/closed principle. Objects/Entities should be open for extension, but closed for modification. All members are private by default L - Liskov Substitution Principle. States that derived classes may be substituted for base classes, and the program will still execute properly. Objects of the derived class must behave in a manner consistent with the promises made in the base class' contract I - interface segregation principle. Many client specific interfaces are better than one general purpose interface i.e. if you implement the interface you should be using every method in that interface - no wasted methods D - dependency inversion principle. Abstractions should not depend on concrete classes, but concrete classes should depend on abstractions i.e. use the same level of abstraction at a given level - interfaces depend on other interfaces
What are the SOLID principles?
.NET Core is both open-source and cross-platform. The CoreCLR and libraries are cross-platform. Those platforms being Windows, OS X, and Linux. .NET Core is compatible with Xamarin to write cross-platform mobile apps. .NET Core allows for easier development for micro-services architecture. .NET Core also allows for easier deployment of .NET Core apps in containers - it works well with Docker and Azure Kubernetes Service. It also supports built-in dependency injection. It is also more lightweight compared to .NET Framework.
What are the major differences between .NET and .NET Core?
Pros Enable continuous delivery and deployment of large complex apps Better test-ability at the service level Better deployability at the service level Organization of the development effort is easier due to development, deployment, and scalability occur independently of other services The application starts faster, making developers more productive and speeds up deployment Bugs are isolated to their services, other services can continue to make requests Microservices eliminate long term commitment to a technology stack - services can be created and updated or rewritten in a different stack Cons Developers have to deal with the complexity of creating a distributed system IDEs are built on monolithic applications and may not provide explicit support for distributed systems Testing can be more difficult across the application Developers must implement inter service communication mechanism Implementing use cases across services can be challenging Deployment complexity Increased memory consumption of N instances by M services
What are the pros and cons of a microservices architecture?
Pros Easy to develop
What are the pros and cons of a monolithic architecture?
Pros Easy to develop early on in a project Simple to test end to end Simple to deploy. Copy packaged application to a server Simple to scale horizontally Cons If app is large and complex hard to maintain and make changes to quickly Size of the app can slow down start time Entire application must be redeployed on update Bugs can potentially impact the entire application Monolithic apps have trouble adopting new and advance technology
What are the pros and cons of a monolithic architecture?
Atomicity, Consistency, Isolation, Durability Atomicity - refers to the integrity of the entire db transaction. Components of the transaction must be processed logically and correctly. Consistency - when data is inserted into the db it must be validated and consistent with current state of the db, else it will be rolled back. Isolation - Concurrent transactions are performed in isolation and committed ensuring the fulfillment of the contract that may exist. Durability - data is saved once a transaction is complete. A transaction cannot occur and the data not be saved.
What is ACID compliance?
Working on your local machine that may be running windows, and pushing the code to a Linux server or something of the like, may give the code problems. Docker offers the ability to create an image of the code base coupled with it's dependencies and installations to be ran as a container within a VM, this can then be pushed to Docker Hub, essentially a repo, and pushed to a server. The container contains the image, and it's installations, allowing for a server to host multiple containers that may contain a Node app and a Rails app on the same machine. The composition of the container has the server with the Host OS on top, and then the Docker Engine installed, then all the apps run as Docker containers that sit on top of the host OS resources. Docker shines in the cloud where you can add containers and load balance them.
What is Docker?
Kubernetes is an orchestration platform for your containers. Handles the work of scheduling containers onto a compute cluster and manages the workloads to ensure they run as the user intended. Some features include automated scheduling, replacing containers that have died, rollouts and rollbacks, and horizontal scaling and load balancing. Kubernetes architecture has master node(s) that interacts with the worker nodes, which are your virtual machines, which have the pods that contain n-number of containers. The etcd connected to the master node stores the cluster state and configuration. Then the external resources connect to the worker nodes.
What is Kubernetes?
Webpack is a module bundler. You set up configurations explaining to the builder how to load specific things. The bundler then figures out exactly what it needs, the dependencies, and then creates the least amount of bundles necessary and optimizes those bundles.
What is Webpack?
A microservices architecture is an architecture in which an application is built as a suite of modular services - each service having its own business logic and database. It is a small instance of a monolithic structure, only at a service level
What is a microservice architecture?
An application, although having different components and modules, that is built and deployed as one application across all platforms. Ascend Labs application was a monolithic application.
What is a monolithic architecture?
A model, view, or some representation for an actual item. The implementation contains the essential properties we find in the object we are representing. Extension methods with FluentValidation, just calling method after method and the implementation is abstracted away.
What is abstraction?
Integrated development environment. Visual studio, VS Code, PyCharm, Jupyter Notebooks, NetBeans, XCode
What is an IDE?
An anti-pattern is response to a reoccurring problem that is ineffective and risks being counter-productive
What is an anti-pattern?
The internal representation of an object is hidden from view outside of the object's definition - typically, only the objects own methods can inspect or manipulate its fields.
What is encapsulation?
Effectively, it is inheriting. A child class extends a parent class, or a derived class extends base class
What is extending class?
An operation is idempotent if there isn't an additional effect if the operation is performed more than once. -Get is idempotent -Post should be reserved for non - idempotent calls -Put is idempotent -Delete is, but isn't, second call will be 404
What is idempotence and state the idempotence for verbs?
The members of the base class are now members of the derived class.
What is inheritance?
This file holds metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies. Package-lock.json stores an exact, versioned dependency tree rather than using starred versioning like package.json itself (e.g. 1.0.*). This means you can guarantee the dependencies for other developers or prod releases, etc.
What is package.json?
Polymorphism is the ability for an object to take on many forms
What is polymorphism?
A dependent object or service is provided to the object at run time. Rather than directly instantiating dependencies or using static references that the object needs, those are provided to the class in some abstracted form.
What is the dependency injection design pattern?
The method determines how form data is submitted to the server. GET method will attach the data as query string parameters to the end of the URL. POST method will pass the data in the request body. GET's data is smaller and less secure, whereas POST's data can be larger and is more secure. POST method data cannot be cached, and GET method data can be cached, which can lead to data consistency issues.
What is the difference between GET and POST?
The singleton pattern is a design principle that restricts the instantiation of a class to one single instance
What is the singleton pattern?