Skip to main content

Posts

SOLID principles

Recent posts

Commonly used methods of MongoOperations in Spring Data MongoDB

 Some commonly used methods of `MongoOperations` in Spring Data MongoDB, along with examples: 1. Insert Documents:    - insert(Object objectToSave)`: Inserts a document into the collection.      YourEntity entity = new YourEntity("value1", "value2");      mongoOperations.insert(entity); 2. Find Documents:    - find(Query query, Class<T> entityClass)`: Finds documents matching the given query.      Query query = new Query(Criteria.where("field1").is("value1"));      List<YourEntity> result = mongoOperations.find(query, YourEntity.class);    - findOne(Query query, Class<T> entityClass)`: Finds the first document matching the query.      Query query = new Query(Criteria.where("field1").is("value1"));      YourEntity entity = mongoOperations.findOne(query, YourEntity.class);      3. Update Documents:    - updateFirst(Query query, Update update, Class<T> entityClass)`: Updates the first document matching the

Functional Interface in Java

 In Java, a functional interface is an interface that has only one abstract method. It is a key concept in functional programming and serves as the foundation for working with lambda expressions and method references. Java 8 introduced functional interfaces to support the new features of the Java language, such as streams and lambdas. Functional interfaces are annotated with the `@FunctionalInterface` annotation, which is optional but recommended. This annotation ensures that the interface has only one abstract method and generates a compile-time error if multiple abstract methods are declared. Although a functional interface can have default methods and static methods, it must have only one abstract method. The single abstract method in a functional interface represents the behavior that can be implemented by lambda expressions or method references. Lambda expressions allow you to define anonymous functions concisely. They provide a way to pass behavior as an argument to methods, maki

Design patterns in Java

Design patterns in Java Design patterns are reusable solutions to common problems that occur in software design. They provide a structured approach to designing software and help improve code organization, maintainability, and flexibility. Here are some commonly used design patterns in Java: 1. Singleton Pattern:    - Ensures that a class has only one instance and provides a global access point to it.    - Example: `java.lang.Runtime` 2. Factory Pattern:    - Provides an interface for creating objects, but lets subclasses decide which class to instantiate.    - Example: `java.util.Calendar` 3. Observer Pattern:    - Defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically.    - Example: `java.util.Observable` and `java.util.Observer` 4. Builder Pattern:    - Separates the construction of complex objects from their representation, allowing the same construction process to create various representat

Scrum - Transparency, Inspection , and Adaptation

What is Scrum ? Scrum is a light weight agile framework that helps people, organization and team to develop the software in iterative and incremental process. Three Pillars of Scrum Transparency - Giving visibility to the significant aspects of the process to those responsible for the outcome. Inspection - Timely checks on the progress toward a sprint goal to detect undesirable variances Adaptation - Adjusting process as soon as possible to minimize any further deviation or issues   These three pillars of the scrum is achieved through different ceremonies and artifacts of the scrum. We can map the pillars as follows Scrum Values  Scrum is built with following 5 values  Commitment - People personally commit to achieving the goals of the Scrum Team Focus - Everyone focuses on the work of the Sprint and the goals of the Scrum Team Openness - The scrum team and its stakeholders agree to be open about all the work and challenges to perform the work Respect - Scrum Team members respect

CI/CD - Continuous integration and continuous delivery

  Old school fashion Integration Let us look into the detail how things are happening before CI/CD process, the old school way. If we take an example of a E-Learning application, there will have product management who creates the vision and defines the requirements for the application according to the market needs. There will have an IT depart who develops, deploys and maintains the application according to the requirements from product team. If we do a closer look into the IT department, there will have programers or different team of programmers who develops the feature according to the instructions from product team. Once it is developed, the source code is passed to build and integration team who then builds these different source code and compile it. Once it is integrated and compiled, it is passed to operations team who take care the deployments. They deploy first in test environment and then passed to Quality Assurance team. Quality assurance team who work closely wi