Daily Summary -02 in ThoughtWorks Pathashala


Did pair programming:
- Got to know how to work with another person while writing code.
- Do ping pong( switching driver-navigator roles).
-
Used TDD for implementing a Rectangle class and added functionalities.
Points discussed:
- Only write failing test cases.
- Write minimum number of test cases while ensuring a safety net.
- Use good names for methods and classes that are understandable by another person.
- Refractor test cases also.
- Use keyboard shortcuts. (Know your IDE well)
- Refractor magic numbers to meaningful constants
- Use @displayName() to display a message representing test case methods in JUNIT5.
- Add job of the class as a comment before the class description. It should describe the context of the class(what it represents). It should not contain class name, attribute or method names and “and”
- Factory methods
    * They are static methods in a class.
    * They can be used to construct something and give it back.
    * They are called by the class and not an object in the class. They cannot  change the state of an object.
    * Use them only if required.
- Add external libraries used by you to the project structure so that other programmers do not have to import it again(shortcut:f4).
- Have minimum dependencies between components so that “blast radius” is small.

Four Rules Of Design (based on priority)
1. Working Code that passes all test cases.
2. Readability
3. Reusability/ No Duplication
4. Short Code/ Fewer Elements: Have fewer classes followed by fewer methods and then fewer variables.                
Consistency: has priority between 1 and 2

Some things to remember
    DRY: Don’t Repeat Yourself
    KISS: Keep It Simple and Stupid
    YAGNI: You Aren’t Gonna Need It
    Don’t think about tomorrow. Do only what is required now.

Homework:
Read on factory methods.
Implement convert roman numerals to arabic
Read property based testing in java using JUNIT5

Comments

Popular posts from this blog

Enum -- just sugar to Class

Daily Summary -01 in ThoughtWorks Pathashala