Solutions: 1) Refactor methods 2) Rename methods to more declarative unes 3) break methods 4) If a comment describe what a method does. Just name the method with this description
Solutions 1) Find methods related to attributes 2) Cluster this methods 3) Break the object related to those clusters 4) Find real objects related to this new objects and replace existing references
Solutions 1) Replace constants with parameters so you can mock them 2) The constant definition is often a different object than the constar (ab)user 3) Group the cohesive parameters
Problems:
Accidental Coupling
Bad Models
Premature Optimization
Solutions:
1 Do not Mix Ids with objects.
2 Ids are only necessary when giving reference to an external system.
3 Objects know objects by references. not by Ids
#codesmell 14: model objects persisting/retrieving
Problems
coupling
Premature optimization
No testability
Solutions:
Break up functions into smaller functions
Create private functions
Create a Method Object
#Codesmell 16: Overriding concrete implementation
Subclass deciding NOT to do what is declared by super
Problems:
Bad Cohesion
Coupling
Subclassing for code reuse
Solutions:
Break inheritance
Move default implementation down
Favor Composition
#CodeSmell 17: Naming a variable is a Bad Naming smell
Names too abstract referring to metamodel like:
-Abstract
-Value
-Result
-Object
-Outcome
-Input
Are code smells.
Find which real world roles are misrepresented on your code
#CodeSmell 18: avoid too abstract names.
Implementative Naming is a code smell.
Repository is an awful name.
Think about real world names like:
-schedule
-notebook
-diary
-journal
CodeSmell #19: Coupling to other objects implementation
When an object is coupled to implementation and not to protocol any change will cause ripple effect.
Nulls are an anti pattern
You can use nulls on databases because null don't execute, but interpreting this nulls is impossible since it might represent different meanings.
Remember Null's autor regret and have mercy on him
Solutions
-Avoid General Purpose Cach
-Benchmark
-Find Bottlenecks
-Create functional contexts and proxies (object in the middle)
-Ask Knuth
#CodeSmell: 23 Missed Preconditions
Problems
-Not fail fast
-Contract breaking
-Hard to debug
-Bad cohesion
Solutions
-Create strong preconditions
-Raise exceptions
-Fail Fast
-Defensive Programming
#CodeSmell 24: Magic Numbers
Problems:
-Maintainability
-Fear to change
Solutions:
-Create constants with long, intention revealing values
-Do not add those constants as static class constants, this will prevent from testing
--Test must be in full control to "play" w/t constants
#codesmell 25:
Trying to build complex solutions for a simple functional problem
with excellent models there's a mapping between code and functional complexity
A simple problem in real world should be fixed simple
Problems:
-Coupling to globals (classes)
-Not Mockable
-Violation on Solid's SOR (class sole responsibility is to create instances)
-Lack of Maintainability
Solutions:
-Move the method to instance in a smaller class
-Refactor
-Dependency injection
Alejandro writes interesting content on software development and machine learning.
He teaches Computer Science and his content is great.
I love interacting with him.
Allen is a DDD passionate. His opinions are very strong and accurate.
I enjoy his development tips AND management and agile humor a lot.
I liked very much his courses on LinkedIn.
1 - Check your phone after a couple of hours.
2 - Keep an eye on the app with the most notifications
3 - Block them
4 - Don't fear #FOMO. Deal with it
5 - Repeat once a day.
1 - Use blocks of time without interruptions (timeboxing).
2 - My favorite is @PomodoroTech.
3 - if you come across new tasks just write them down.
4 - Don't multitask.
5 - You cannot switch until time is up.
6 - 25 minutes it's a good slice.