← All repositories

iluwatarjava-design-patterns

Java Design Patterns

Features

  • Code Snippets```java public class CreatingObjectSnippet { /** * Create object using reflection. * * @param cls fully qualified name of class includes the package name as String * @return object * @throws NoSuchMethodException if a me
  • Design Pattern CatalogsA comprehensive collection of architectural patterns and software design principles implemented in a standard programming language for educational reference.
  • Software Engineering Knowledge BasesA curated repository of best practices, programming principles, and architectural guidelines designed to improve code quality and maintainability.
  • Algorithmic ImplementationsA collection of common algorithmic implementations and utility functions providing practical examples for solving recurring programming challenges.
  • Algorithms```java public class InsertionSortSnippet { /** * Sort an array with insertionSort algorithm. * * @param arr array to sort */ public static void insertionSort(int[] arr) { for (var i = 1; i < arr.length; i++) { var tmp =
  • Pattern-Based TaxonomiesOrganizes complex software engineering concepts into a structured, navigable hierarchy of reusable design patterns and architectural principles.
  • Interface-Centric ArchitecturesPromotes the use of abstract contracts to hide implementation details, enabling flexible system evolution and adherence to substitution principles.
  • YAGNI PrinciplesYAGNI stands for "you aren't gonna need it": don't implement something until it is necessary. Why - Any work that's only used for a feature that's needed tomorrow, means losing effort from features that need to be done f
  • Algorithmic UtilitiesProvides a collection of stateless, functional code snippets that perform discrete algorithmic tasks without maintaining internal object state.
  • Architectural Principles| Learning established design patterns and architectural principles to build maintainable, scalable, and robust object-oriented software systems.
  • Java Best Practices| Adopting idiomatic coding standards and proven design patterns to improve code quality and developer productivity in Java projects.
  • Developer Learning ResourcesActs as a centralized, curated index of best practices and implementation examples to facilitate developer learning and skill acquisition.
  • File System Utilities```java public class ListAllFilesSnippet { /** * Recursively list all the files in directory. * * @param path the path to start the search from * @return list of all files */ public static List<File> listAllFiles(String
  • Search Algorithms```java public class LinearSearchSnippet { /** * Search an item with linearSearch algorithm. * * @param arr array to search * @param item an item to search * @return if item is found, return the index position of the arr
  • Sorting Algorithms```java public class BubbleSortSnippet { /** * Sort an array with bubbleSort algorithm. * * @param arr array to sort */ public static void bubbleSort(int[] arr) { var lastIndex = arr.length - 1; for (var j = 0; j < lastI
  • Technical Reference HubsA structured knowledge hub offering developers high-quality documentation and learning materials to master complex software design concepts.
  • Decoupled ImplementationsIsolates specific computational logic into independent, interchangeable units to minimize dependencies and maximize code reuse across different contexts.
  • Command Query SeparationThe Command Query Separation principle states that each method should be either a command that performs an action or a query that returns data to the caller but not both. Asking a question should not modify the answer. W
  • Coupling ManagementCoupling between modules/components is their degree of mutual interdependence; lower coupling is better. In other words, coupling is the probability that code unit "B" will "break" after an unknown change to code unit "A
  • DRY PrinciplesEvery piece of knowledge must have a single, unambiguous, authoritative representation within a system. Each significant piece of functionality in a program should be implemented in just one place in the source code. Whe
  • Interface Segregation PrinciplesReduce fat interfaces into multiple smaller and more specific client specific interfaces. An interface should be more dependent on the code that calls it than the code that implements it. Why - If a class implements meth
  • Inversion of ControlInversion of Control is also known as the Hollywood Principle, "Don't call us, we'll call you". It is a design principle in which custom-written portions of a computer program receive the flow of control from a generic f
  • Law of DemeterDon't talk to strangers. Why - It usually tightens coupling - It might reveal too much implementation details How A method of an object may only call methods of: 1. The object itself. 2. An argument of the method. 3. Any
  • Liskov Substitution PrinciplesThe LSP is all about expected behavior of objects: > Objects in a program should be replaceable with instances of their subtypes > without altering the correctness of that program. Resources - [Liskov substitution princi
  • Maintainability PrinciplesWhy - Maintenance is by far the most expensive phase of any project. How - *Be* the maintainer. - Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. - Always
  • Robustness Principles> Be conservative in what you do, be liberal in what you accept from others Collaborating services depend on each others interfaces. Often the interfaces need to evolve causing the other end to receive unspecified data.
  • Simplicity PrinciplesWhy - Real progress against the real problem is maximized if we just work on what the problem really is. How - Ask yourself: "What is the simplest thing that could possibly work?" Resources - [Do The Simplest Thing That