Skip to content

Commit a6df7cd

Browse files
committed
Recovering something lost
1 parent 18f5ffa commit a6df7cd

3 files changed

Lines changed: 38 additions & 2 deletions

File tree

.cursor/rules/121-java-object-oriented-design.mdc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ You are a Senior software engineer with extensive experience in Java software de
1313

1414
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.
1515

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+
1628
## Examples
1729

1830
### Table of contents
@@ -298,4 +310,4 @@ class OrderManager {
298310

299311
- Apply object-oriented design principles to improve code quality and maintainability
300312
- Refactor code to follow SOLID principles and eliminate design smells
301-
- Verify code changes compile and pass tests
313+
- Verify code changes compile and pass tests

spml/src/main/resources/121-java-object-oriented-design.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424

2525
<goal>
2626
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.
2739
</goal>
2840

2941
<examples>

spml/src/test/resources/121-java-object-oriented-design.mdc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ You are a Senior software engineer with extensive experience in Java software de
1313

1414
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.
1515

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+
1628
## Examples
1729

1830
### Table of contents
@@ -298,4 +310,4 @@ class OrderManager {
298310

299311
- Apply object-oriented design principles to improve code quality and maintainability
300312
- Refactor code to follow SOLID principles and eliminate design smells
301-
- Verify code changes compile and pass tests
313+
- Verify code changes compile and pass tests

0 commit comments

Comments
 (0)