Software Engineer concepts Flashcards
(79 cards)
/Encapsulation in OOP
- Encapsulation is the bundling of data (attributes) and methods (functions) that operate on the data into a single unit called a class. It also involves restricting access to some components, protecting the integrity of the object’s data by using access modifiers such as private, public, and protected.
- Example: A Car class with private data like speed and public methods like accelerate() and brake().
/Abstraction in OOP
- Abstraction hides the complex implementation details of a system and shows only the essential features to the user. The idea is to reduce complexity and allow the programmer to focus on interactions at a high level.
- Example: You use a method startEngine() in a Car class without needing to know the internal workings of how the engine starts.
/Inheritance in OOP
- Inheritance allows one class (child or subclass) to inherit properties and methods from another class (parent or superclass). This promotes code reuse and establishes a natural hierarchy between classes.
- Example: A Sedan class can inherit from a general Car class, thus inheriting properties like speed and methods like drive().
/Polymorphism in OOP
- Polymorphism means “many forms” and allows objects of different classes to be treated as objects of a common superclass. There are two types of polymorphism:
- Compile-time (method overloading): Multiple methods can have the same name but different parameters.
- Run-time (method overriding): A subclass can provide its own implementation of a method that is already defined in its superclass.
- Example: A Vehicle class has a method move(). Both Car and Bike inherit move(), but each has its own implementation (overriding it) depending on the type of vehicle.
/What are the SOLID principles?
- Single Responsibility Principle (SRP): A class should have only one reason to change. It states that a class should have only one responsibility or purpose. This helps keep classes focused and makes them easier to understand, test, and maintain.
- Open-Closed Principle (OCP): Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification. This principle encourages designing modules that can be extended with new functionality without modifying their existing code. This promotes code reuse and minimizes the risk of introducing bugs when making changes.
- Liskov Substitution Principle (LSP): Objects of a superclass should be replaceable with objects of their subclasses without affecting the correctness of the program. It ensures that derived classes can be used as substitutes for their base classes without causing unexpected behavior. This principle defines a behavioral contract that derived classes must uphold.
- Interface Segregation Principle (ISP): The Interface Segregation Principle (ISP) is a key principle in object-oriented design, advocating for creating specialized interfaces rather than large, general-purpose ones. Clients should not be forced to depend on interfaces they do not use. It promotes the idea of segregating interfaces into smaller and more focused ones, tailored to specific client needs. This prevents clients from being burdened with unnecessary dependencies and provides better flexibility and maintainability.
- Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details; details should depend on abstractions. It encourages decoupling and dependency injection, where dependencies are defined through interfaces or abstractions instead of concrete implementations. This improves flexibility, testability, and modularity.
/what is asynchronous programming
Asynchronous programming is a programming paradigm that allows tasks or operations to run independently of the main program flow, without blocking the execution of other tasks. It is particularly useful for operations that can take a long time to complete, such as file I/O, network requests, or database access, enabling the application to remain responsive while those tasks are running in the background.
In asynchronous programming, instead of waiting for a long-running task to finish before proceeding, the program can continue executing other code, and the result of the task is handled when it eventually completes.
/What is IoC - Inversion of Control?
Inversion of Control (IoC) is a design principle in software engineering where the flow of control of a program is inverted compared to traditional programming. Instead of the program controlling how objects and services are created and managed, control is “inverted” to a framework or external component. The key idea is that components don’t directly instantiate or manage their dependencies. Instead, those dependencies are provided or “injected” by an external mechanism.
IoC helps in loosely coupling components, making the system more modular, testable, and easier to maintain.
/What is Dependency Injection?
Dependency Injection (DI) is a specific implementation of the IoC principle. It refers to the practice of injecting the dependencies (such as services or objects) that a class needs from the outside rather than the class instantiating them itself. The dependencies are injected via one of three common methods:
* Constructor Injection (most common)
* Property Injection
* Method Injection
DI is a way to implement IoC, where an external component (typically an IoC container) provides the dependencies for a class.
/What is a Docker file, and what does it define?
A Docker file is a blueprint that defines the steps to create a Docker image, specifying the base image, dependencies, file transfers, and default commands.
/What are Docker images, and how are they created?
Docker images are read-only snapshots of environments, created using docker build from Docker files.
A Docker image is a file used to execute code in a Docker container. Docker images act as a set of instructions to build a Docker cotainer, such as a template. Docker images also act as the starting point when using Docker. An image is comparable to a snapshot in virtual machine (VM) environments.
/How do containers relate to Docker images?
Containers are runtime instances of Docker images, running in isolation with their own filesystem, network, and processes.
/What is Docker’s primary purpose?
To simplify the creation of consistent environments and isolate applications from host dependencies.
/What is one of Docker’s most significant advantages for software development?
Fast, lightweight, and portable container environments.
/What is docker-compose.yml file for?
The docker-compose.yml file is used to define and manage multi-container Docker applications. It allows you to configure and run multiple Docker containers as a single service. This file is written in YAML format and specifies the services, networks, and volumes required for your application.
Purpose of the docker-compose.yml File
The primary purpose of this file is to define the configuration for all the services that make up your application. This includes specifying the Docker images to use, the ports to expose, environment variables, volumes, and other settings. By using docker-compose, you can easily start, stop, and manage all the services with a single command.
/What Is OpenAPI?
OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:
* Available endpoints (/users) and operations on each endpoint (GET /users, POST /users)
* Operation parameters Input and output for each operation
* Authentication methods
* Contact information, license, terms of use, and other information.
API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines.
/What Is Swagger?
Swagger is a set of open-source tools built around the OpenAPI Specification that can help you design, build, document, and consume REST APIs.
/What is REST?
The Six Guiding Principles of REST are:
1. Uniform Interface
2. Client-Server
3. Stateless
4. Cacheable
5. Layered System
6. Code on Demand (optional)
https://restfulapi.net/
/What is TCP?
TCP stands for Transmission Control Protocol, a communications standard that enables devices and applications to exchange data over a network. TCP is a fundamental part of the internet’s rules and is one of the most commonly used protocols in digital network communications.
TCP works with the Internet Protocol (IP) to ensure that data is delivered reliably.
TCP (Transmission Control Protocol) is an important network protocol that lets two hosts connect and exchange data streams. TCP guarantees the delivery of data and packets in the same order as they were sent.
/What is HTTP?
Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.
HTTP is a protocol for fetching resources such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is typically constructed from resources such as text content, layout instructions, images, videos, scripts, and more.
/What is TLS?
Transport Layer Security (TLS), formerly known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols. Both TLS and SSL are client / server protocols that ensure communication privacy by using cryptographic protocols to provide security over a network. When a server and client communicate using TLS, it ensures that no third party can eavesdrop or tamper with any message.
All modern browsers support the TLS protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. It is possible for both the client and server to mutually authenticate each other, if both parties provide their own individual digital certificates.
/What is Cache?
A cache (web cache or HTTP cache) is a component that stores HTTP responses temporarily so that it can be used for subsequent HTTP requests as long as it meets certain conditions.
/What is a host (network)?
A host is a device that can access a network and communicate with other devices on that network.
/What is the difference between TCP and TLS?
The main difference between TCP and TLS is that TCP is responsible for reliable data delivery, while TLS is responsible for encrypting and securing data:
TCP (Transmission Control Protocol)
Responsible for establishing reliable connections and ensuring data is sent and received accurately between devices over a network. TCP is the backbone of internet communication.
TLS (Transport Layer Security)
Responsible for encrypting data during transmission to ensure privacy and security. TLS adds a layer of security on top of TCP, using symmetric and public key encryption, authentication, and message tampering detection.
TLS is an updated, more secure version of SSL, and the terms are often used interchangeably. TLS handshakes occur after a TCP connection has been opened.
/What is the application layer in the OSI model?
The Application Layer of OSI (Open System Interconnection) model, is the top layer in this model and takes care of network communication. The application layer provides the functionality to send and receive data from users. It acts as the interface between the user and the application. The application provides services like file transmission, mail service, and many more.