Refactoring: How do I even start?
socalledprogrammer.com
Refactoring: How do I even start?
1–10 of 41 posts
Re: Refactoring: How do I even start?
#2Re: Refactoring: How do I even start?
#3 if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 )
{
for( Integer y = 0; y
The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well...Re: Refactoring: How do I even start?
#4In some cases it shows its age (especially when it comes to rolling your own mock testing, most languages have automated frameworks for that now), but it's still a great overview of the techniques you can employ.
Re: Refactoring: How do I even start?
#5> is the name of the blog; the title of submitted post is "Refactoring: How do I even start?". Could mods change this please?
Re: Refactoring: How do I even start?
#6if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 ) { for( Integer y = 0; y The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well...
That's false. A list object may be initialized but be empty (making it's length zero). Or it may not be initialized (making it null).
Both conditions may happen independently of one another. He checks for the null first so that checking the length does not throw a NPE.
> The if-statement is a good summary of what is wrong with Java.
Frankly, I see nothing wrong here.
Re: Refactoring: How do I even start?
#7Re: Refactoring: How do I even start?
#8if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 ) { for( Integer y = 0; y The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well...
> The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well.. That's false. A list object may be initialized but be empty (making it's length zero). Or it may not be initialized (making it null). Both conditions may happen independently of one another. He checks for the null first so that checking the length does not throw a NPE. > The if-statement is…
Re: Refactoring: How do I even start?
#9if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 ) { for( Integer y = 0; y The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well...
Doesn't it check if a list isn't null and then if the list has at least one item in it? Or are you simply saying the for loop takes care of the situation where there are 0 items in the list?
Re: Refactoring: How do I even start?
#10if( masterList[z].list2 != NULL && masterList[z].list2.length() > 0 ) { for( Integer y = 0; y The if-statement is a good summary of what is wrong with Java. The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well...
> The author doesn't even notice that the second argument of && is redundant and keeps it in the "refactored" version as well.. That's false. A list object may be initialized but be empty (making it's length zero). Or it may not be initialized (making it null). Both conditions may happen independently of one another. He checks for the null first so that checking the length does not throw a NPE. > The if-statement is…
I know an even lower level language (C++, C) that doesn't have the problem of things which make no sense to be NULL (list elements). The problem is that Java did away completely with value types and made everything pointer only. That has been recognized by later languages (C#) and fixed.
The whole code consists of problems: the first is the language, the second is the programmer, the third is the missing for-each construct.