We all "know" how to setup a new project architecture. The real challenge is in fixing the existing one. The presentation is going to show us how to clean and organize our existing project's code into patterns with a sequence of low-level refactorings.
We are going to learn to:
- Identify the best candidates for refactor;
- Improve the design of the existing code - with solution to recurring design problems;
- To refactor or not to refactor to a pattern
- Become a better software engineers by making important changes safely and effectively;
3. Why your code sucks and how
to fix it
Marjan Nikolovski
Senior Software Engineer, Seavus
Co-Owner, EmitKnowledge
emitknowledge.com/@mnikolovski
mk.linkedin.com/in/marjannikolovski
5. Refactoring
A change made to the internal structure of
software to make it easier to understand and
cheaper to modify without changing its
observable behavior
6. Why refactoring – Technical factors
Make your code easier to understand
Make it easier to add new code
Improve the design of the codebase
Remove unused code
Better understanding of your codebase
Evolve your architecture instead of over
engineering it
7. Why refactoring – Psychological factors
Learn to embrace the change
Refactors are result of code reviews. Accept
that sometimes your code sucks !
Loose your fear to change existing codebase
8. When to refactor
Add new functionality
– Refactor existing code to make the change with
ease
Find bugs
– Refactor to understand the code
Code reviews
– Immediate results of the code review
End of a development iteration
– Fix what is shitty
9. Why your code sucks
Your code sucks if it doesn't work
Your code sucks if it isn't testable
Your code sucks if it's hard to read
Your code sucks if it's not understandable
Your code sucks if overuse a trendy framework at the cost of following good
design/implementation practices
Your code sucks if it has duplication
Your code sucks if your function names suck
Your code sucks if your variable names suck
Your code sucks if your class names suck
Your code sucks if your abstractions suck
Your code sucks if a method is larger than the screen
Your code sucks if you are reusing variables
Your code sucks if you need to use comments to explain the code
Your code sucks if an exception's stack trace doesn't return the original problem
29. Long method
Use extract to method
Minimize code nesting to maximum 1 level
with method extraction
Extract each iteration as a method
Extract multiple conditions as method
45. Questions?
• Complete electronic evaluation
forms on the computers in the
hall and enter to win!
– Telerik Ultimate Collection
– CodeSmith Tools Generator Pro
Personal
– JetBrains ReSharper
– Seavus EDC training vouchers
– Pluralsight subscriptions
– and many more…