Please refactor these 6 java lines
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Any ideas on how to improve this code's readability ?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Perhaps you can post the entire method and include any tests you have written for it? I can derive that your method returns boolean due to the "return false" on line 10 but that's about it.
Tim Driven Development | Test until the fear goes away
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Dieter Quickfend wrote:
You missed what it said on line 12 of the original post.
Joanne
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Joanne Neal wrote:
You missed what it said on line 12 of the original post.
I would assume that it would be no great feat to use longValue(randomString) in the rest of the method.
Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
This is from a function that has multiple similar blocks of code like this one, one after another. Basically an object has many fields, and I need to set each of those values from an array of String.
Could I write this easier to read/more elegant ?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Tim Driven Development | Test until the fear goes away
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
This could be useful as it will improve a lot of people's coding style.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I agree that discussing refactoring is a valuable thing to do but we should do it one problem at a time, one topic at a time.
Tim Driven Development | Test until the fear goes away
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Tim Cooke wrote:Far too generic. We'll end up with a huge single topic with multiple refactoring discussions in it. How would that be useful? How would you search it? How would we talk about it? "Oh that particular refactoring was discussed in the 'Refactoring' topic on page 74". It's just not manageable at all. It's akin to saying "Shouldn't we put all our code in main? It's all just code after all right?"
I agree that discussing refactoring is a valuable thing to do but we should do it one problem at a time, one topic at a time.
I like the way you think, and indeed this has the potential to turn into an epic thread. Would it not be better though if all refactoring discussions happen in a single thread just like you described ? I mean, a novice programmer could just browse through conveniently because it is all in one place.
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
What I'd suggest is using one thread per discussion. And if there were enough of these threads, or if we decided we wanted to encourage more of them, then a new forum could be created specially for them. That would meet the requirement for someone to find them all in one place.
| I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission. Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |












