„Einen von zwei Schmerzen müssen wir ertragen: den Schmerz der Disziplin oder den eines schlechten Gewissens. Der Unterschied ist, Disziplin
wiegt Gramm, ein schlechtes Gewissen wiegt Tonnen.“ – Jim Rohn, US-amerikanischer Motivationstrainer
This week was all about refactoring. We were supposed to download a repository on github and refactor the example code with the help of a book
(
http://silab.fon.bg.ac.rs/wp-content/uploads/2016/10/Refactoring-Improving-the-Design-of-Existing-Code-Addison-Wesley-Professional-1999.pdf )
and upload this to our own repository on github. The book and the methods in it were supposed to show us how to refactor cleverly using the example.
The book also taught us how to cleverly shorten or move code to get a better overview. In the end, it was a matter of applying what we had learned
with the help of the examples in the book.
You can find our repositories at
https://github.com/Sebastian-Zok/FowlerRefactoring (Sebastian) and
https://github.com/0Raspbinary1/SE_Refactoring (Rouven).
The original repository can be found here:
https://github.com/gnilkreb/Fowler
Additionally we have 2 useful refactoring functions for you, which you can use (in the IDE Eclipse):
- Using Autoformat Code
With the Autoformat function you can keep track of your code and find it faster in case of an error. Since Eclipse is available for several
operating systems, the shortcut here is different:
To format code using the Autoformat function on Windows, press [CTRL]+[SHIFT]+[F] simultaneously. Under MacOS you use the key combination [CMD]+SHIFT]+[F].
- Using Rename
Rename can be used when you decide to rename for example a variable. The key combination [CTRL]+[SHIFT]+[r] can be used to rename the variable,
at any point where it has been used.
All the best,
Your workout-log team!