You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/rules/121-java-object-oriented-design.mdc
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,18 @@ You are a Senior software engineer with extensive experience in Java software de
13
13
14
14
Apply comprehensive guidelines for robust Java object-oriented design and refactoring. Follow core principles like SOLID, DRY, and YAGNI, implement best practices for class and interface design including favoring composition over inheritance and designing for immutability. Master encapsulation, inheritance, and polymorphism, and identify and refactor common object-oriented design code smells such as God Classes, Feature Envy, and Data Clumps to promote maintainable, flexible, and understandable code.
15
15
16
+
### Implementing These Principles
17
+
18
+
These guidelines are built upon the following core principles:
19
+
20
+
1. **Adherence to Fundamental Design Principles**: Embrace foundational principles like SOLID, DRY, and YAGNI. These principles are key to building systems that are robust, maintainable, flexible, and easy to understand.
21
+
2. **Effective Class and Interface Design**: Employ best practices for designing classes and interfaces. This includes favoring composition over inheritance to achieve flexibility, programming to an interface rather than an implementation to promote loose coupling, keeping classes small and focused on a single responsibility, and designing for immutability where appropriate to enhance simplicity and thread-safety.
22
+
3. **Mastery of Core OOP Concepts**: Thoroughly understand and correctly apply the pillars of object-oriented programming:
23
+
* **Encapsulation**: Protect internal state and expose behavior through well-defined interfaces.
24
+
* **Inheritance**: Model true "is-a" relationships, ensuring subclasses are substitutable for their base types (Liskov Substitution Principle).
25
+
* **Polymorphism**: Allow objects of different types to respond to the same message in their own way, simplifying client code.
26
+
4. **Proactive Code Smell Management**: Develop the ability to identify common object-oriented design "code smells" (e.g., God Class, Feature Envy, Data Clumps, Refused Bequest). Recognizing and refactoring these smells is crucial for improving the long-term health, maintainability, and clarity of the codebase.
27
+
16
28
## Examples
17
29
18
30
### Table of contents
@@ -298,4 +310,4 @@ class OrderManager {
298
310
299
311
- Apply object-oriented design principles to improve code quality and maintainability
300
312
- Refactor code to follow SOLID principles and eliminate design smells
Copy file name to clipboardExpand all lines: spml/src/main/resources/121-java-object-oriented-design.xml
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,18 @@
24
24
25
25
<goal>
26
26
Apply comprehensive guidelines for robust Java object-oriented design and refactoring. Follow core principles like SOLID, DRY, and YAGNI, implement best practices for class and interface design including favoring composition over inheritance and designing for immutability. Master encapsulation, inheritance, and polymorphism, and identify and refactor common object-oriented design code smells such as God Classes, Feature Envy, and Data Clumps to promote maintainable, flexible, and understandable code.
27
+
28
+
### Implementing These Principles
29
+
30
+
These guidelines are built upon the following core principles:
31
+
32
+
1. **Adherence to Fundamental Design Principles**: Embrace foundational principles like SOLID, DRY, and YAGNI. These principles are key to building systems that are robust, maintainable, flexible, and easy to understand.
33
+
2. **Effective Class and Interface Design**: Employ best practices for designing classes and interfaces. This includes favoring composition over inheritance to achieve flexibility, programming to an interface rather than an implementation to promote loose coupling, keeping classes small and focused on a single responsibility, and designing for immutability where appropriate to enhance simplicity and thread-safety.
34
+
3. **Mastery of Core OOP Concepts**: Thoroughly understand and correctly apply the pillars of object-oriented programming:
35
+
* **Encapsulation**: Protect internal state and expose behavior through well-defined interfaces.
36
+
* **Inheritance**: Model true "is-a" relationships, ensuring subclasses are substitutable for their base types (Liskov Substitution Principle).
37
+
* **Polymorphism**: Allow objects of different types to respond to the same message in their own way, simplifying client code.
38
+
4. **Proactive Code Smell Management**: Develop the ability to identify common object-oriented design "code smells" (e.g., God Class, Feature Envy, Data Clumps, Refused Bequest). Recognizing and refactoring these smells is crucial for improving the long-term health, maintainability, and clarity of the codebase.
Copy file name to clipboardExpand all lines: spml/src/test/resources/121-java-object-oriented-design.mdc
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,18 @@ You are a Senior software engineer with extensive experience in Java software de
13
13
14
14
Apply comprehensive guidelines for robust Java object-oriented design and refactoring. Follow core principles like SOLID, DRY, and YAGNI, implement best practices for class and interface design including favoring composition over inheritance and designing for immutability. Master encapsulation, inheritance, and polymorphism, and identify and refactor common object-oriented design code smells such as God Classes, Feature Envy, and Data Clumps to promote maintainable, flexible, and understandable code.
15
15
16
+
### Implementing These Principles
17
+
18
+
These guidelines are built upon the following core principles:
19
+
20
+
1. **Adherence to Fundamental Design Principles**: Embrace foundational principles like SOLID, DRY, and YAGNI. These principles are key to building systems that are robust, maintainable, flexible, and easy to understand.
21
+
2. **Effective Class and Interface Design**: Employ best practices for designing classes and interfaces. This includes favoring composition over inheritance to achieve flexibility, programming to an interface rather than an implementation to promote loose coupling, keeping classes small and focused on a single responsibility, and designing for immutability where appropriate to enhance simplicity and thread-safety.
22
+
3. **Mastery of Core OOP Concepts**: Thoroughly understand and correctly apply the pillars of object-oriented programming:
23
+
* **Encapsulation**: Protect internal state and expose behavior through well-defined interfaces.
24
+
* **Inheritance**: Model true "is-a" relationships, ensuring subclasses are substitutable for their base types (Liskov Substitution Principle).
25
+
* **Polymorphism**: Allow objects of different types to respond to the same message in their own way, simplifying client code.
26
+
4. **Proactive Code Smell Management**: Develop the ability to identify common object-oriented design "code smells" (e.g., God Class, Feature Envy, Data Clumps, Refused Bequest). Recognizing and refactoring these smells is crucial for improving the long-term health, maintainability, and clarity of the codebase.
27
+
16
28
## Examples
17
29
18
30
### Table of contents
@@ -298,4 +310,4 @@ class OrderManager {
298
310
299
311
- Apply object-oriented design principles to improve code quality and maintainability
300
312
- Refactor code to follow SOLID principles and eliminate design smells
0 commit comments