CellCoreOriginal is subclass of CellCore, and this class must Override preformMitosis() and getRandomOrientation() method.
Due to those method's poor understandability(readability), I Extract methods from those methods, use local variable to improve readability of conditions, and Rename variables.
As a result, performMitosis() method's code was simplifed to 4 line, and each line presents exact mening of PerformMitosis() - generate RNA, generate Child Core, Position Both Parent and Child's DNA Header, and then return Child Core.
getRandomOrientation() method's readability also improved a lot, it uses local variables(such scope was at if condition) named val. but it dose not completely explain the meaning of variable. So I renamed it to base which means the base of DNA. As same reason, I renamed Sumdna to massOfDNA. I extracted local variable DNAexist which means there is DNA(by checking its massOfDNA). Lastly, I extract method which has same name(but declared private, getRandomOrientation). It contains internal logic of generating random varibale based on DNA, and use it as Orientation's index. By doing this, the gerRandomOrientation(public) has improved readability, divided into two parts(Initialization part and Generation part)
CellCoreOriginal is subclass of CellCore, and this class must Override preformMitosis() and getRandomOrientation() method.
Due to those method's poor understandability(readability), I Extract methods from those methods, use local variable to improve readability of conditions, and Rename variables.
As a result, performMitosis() method's code was simplifed to 4 line, and each line presents exact mening of PerformMitosis() - generate RNA, generate Child Core, Position Both Parent and Child's DNA Header, and then return Child Core.
getRandomOrientation() method's readability also improved a lot, it uses local variables(such scope was at if condition) named
val
. but it dose not completely explain the meaning of variable. So I renamed it tobase
which means the base of DNA. As same reason, I renamed Sumdna to massOfDNA. I extracted local variable DNAexist which means there is DNA(by checking its massOfDNA). Lastly, I extract method which has same name(but declared private, getRandomOrientation). It contains internal logic of generating random varibale based on DNA, and use it as Orientation's index. By doing this, the gerRandomOrientation(public) has improved readability, divided into two parts(Initialization part and Generation part)