Principle Flashcards

1
Q

Solid Principle

A

It is a popular set of design principles that are used in object-oriented software development.
Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Object-oriented principle

A

Encapsulation, Abstraction, Inheritance Polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

inversion of control vs Dependency injection

A

Inversion of Control is a principle in software engineering which transfers the control of objects or portions of a program to a container or framework. We most often use it in the context of object-oriented programming.

In contrast with traditional programming, in which our custom code makes calls to a library, IoC enables a framework to take control of the flow of a program and make calls to our custom code. To enable this, frameworks use abstractions with additional behavior built in. If we want to add our own behavior, we need to extend the classes of the framework or plugin our own classes.

Dependency Injection (DI) is a pattern we can use to implement IoC, where the control being inverted is setting an object’s dependencies.

IOC, Template pattern Strategy design pattern, Service Locator pattern, Factory pattern, and Dependency Injection (DI). because the implementation can only be changed through sub-classing. is a DI is a more specific version of IoC pattern, where implementations are passed into an object through constructors/setters/service lookups, which the object will “depend” on in order to behave correctly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

java garbage collection

A

Sequential, Parallel, G1 , ZGC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Single Responsibility

A

SRP does not guarantee that code will be reusable, but it does aim to reduce the scope of what any
piece of code does. This way of thinking about code as a series of building blocks where each one does
a small part of the overall task is more likely to result in reusable components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Dependency inversion, dependency injection, and inversion of control

A

Dependency inversion is the design technique where we create an abstraction in our code.
Dependency injection is the runtime technique where we supply an implementation of that abstraction to code that depends on it.
Together, these ideas are often termed Inversion of Control (IoC). Frameworks are sometimes called IoC containers because they provide tools to help you manage creating and injecting dependencies in an application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What Is Inversion of Control?

A

Inversion of Control is a principle in software engineering which transfers the control of objects or portions of a program to a container or framework. We most often use it in the context of object-oriented programming.

In contrast with traditional programming, in which our custom code makes calls to a library, IoC enables a framework to take control of the flow of a program and make calls to our custom code. To enable this, frameworks use abstractions with additional behavior built in. If we want to add our own behavior, we need to extend the classes of the framework or plugin our own classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The advantages of Inversion of Control?

A

decoupling the execution of a task from its implementation
making it easier to switch between different implementations
greater modularity of a program greater ease in testing a program by isolating a component or mocking its dependencies, and allowing components to communicate through contracts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

value object?

A

is a concept used to represent an object whose equality is determined by its attribute values rather than by identity.

characterized by two key attributes:

Immutability: Value objects are usually immutable, which means their state cannot change after they are created. Any operation on a value object results in a new value object.

Equality Based on Attributes: The equality of value objects is based on the equality of their attribute values. If two value objects have the same attribute values, they are considered equal, even if they are distinct instances.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What Do Code Reviewers Look For?

A

Design: Is the code well-designed and appropriate for your system?
Functionality: Does the code behave as the author likely intended? Is the way the code behaves good for its users?
Complexity: Could the code be made simpler? Would another developer be able to easily understand and use this code when they come across it in the future?
Tests: Does the code have correct and well-designed automated tests?
Naming: Did the developer choose clear names for variables, classes, methods, etc.?
Comments: Are the comments clear and useful?
Style: Does the code follow our style guides?
Documentation: Did the developer also update relevant documentation?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly