In my case, there was plenty of untested code
Posted: Mon Dec 23, 2024 5:07 am
and – what’s more – untestable code. One of the helpful tools, in this case, is PowerMock. It provides you with mechanisms to mock static methods, constructors, final classes and methods, private methods, removal of static initializers and more. They can help you to save some time.
giphy Refactor the code using Kotlin
When we have our class tested, we can go bulgaria phone number forward to refactorization. First I thought that my comeback to writing in Java will be unnoticeable. But I was doing silly mistakes. For example, I was forgetting about semicolons and “new” before a class constructor. I realized how much do I miss Kotlin.
But even if the code is written in Java, we do not have to resign from Kotlin fancy features. As Kotlin language creators say, the language is interoperable with Java. So it means, you can implement new stuff in Kotlin, which will be much more concise than then written in Java.
Kotlin helps a lot in case of refactorization. Some things can take much more time rewriting them clean in Java style. So consider extracting code to new Kotlin class and then simplify it and use it in a Java code.
Why understanding the legacy code is so important?
One could say: Why Gradle and Manifest review is so important? I prefer to get to know the project on the fly than staring on those files and wasting time.
Well, our work is closely connected with business and our clients want to know how much time will it take to provide new functionalities. Having a good project overview and understanding it is crucial to provide accurate time estimations which in turn allows preventing complications in the future.
giphy Refactor the code using Kotlin
When we have our class tested, we can go bulgaria phone number forward to refactorization. First I thought that my comeback to writing in Java will be unnoticeable. But I was doing silly mistakes. For example, I was forgetting about semicolons and “new” before a class constructor. I realized how much do I miss Kotlin.
But even if the code is written in Java, we do not have to resign from Kotlin fancy features. As Kotlin language creators say, the language is interoperable with Java. So it means, you can implement new stuff in Kotlin, which will be much more concise than then written in Java.
Kotlin helps a lot in case of refactorization. Some things can take much more time rewriting them clean in Java style. So consider extracting code to new Kotlin class and then simplify it and use it in a Java code.
Why understanding the legacy code is so important?
One could say: Why Gradle and Manifest review is so important? I prefer to get to know the project on the fly than staring on those files and wasting time.
Well, our work is closely connected with business and our clients want to know how much time will it take to provide new functionalities. Having a good project overview and understanding it is crucial to provide accurate time estimations which in turn allows preventing complications in the future.