Christian Clausen wrote:Hi Bryant,
I think as long as you are comfortable with loops, methods, and objects you could pick up refactoring if you want to.
Christian Clausen wrote: However, picking up a new language -- no matter how similar -- is bound to cause some frustration, so be prepared for that.
Christian Clausen wrote:For me the steps are: First get it to work, any way you can, it doesn't have to be pretty. Then refactor it, before delivering/deploying it.
Christian Clausen wrote:For me the steps are: First get it to work, any way you can, it doesn't have to be pretty. Then refactor it, before delivering/deploying it.
Junilu Lacar wrote: If you don't refactor as you go and end up with 50 lines of code in one method—something I see all the time in real life—it's much harder to refactor that down to 5 lines than if you had kept extracting/refactoring along the way in the first place.
Christian Clausen wrote:For me the steps are: First get it to work, any way you can, it doesn't have to be pretty.
bryant rob wrote:Junilu, 50 lines of code...how could anyone keep track of what is going on with that type coding. I get lost with 5 lines of some code. In the real world would how would or could a a dev team, supervisor, or project manager allow this type of coding to take place in the first place.
bryant rob wrote:To me, as long as I got the code to work I didn't care what it looked like and I was moving on. Now, even at the elementary stage that I am in I am thinking about the code I write...Firstly, I need to get it to work. Secondly, I am thinking what can I do to reduce duplicate code, and place code in separate methods where it makes sense to. Then this way if I need to post some of the code here for help in something I at least feel that I have given it my best in presenting the best code possible. I sort of liken it to my penmanship. My wife is an English teacher and is always trying to better her students handwriting.
John F. Woods wrote:Always code as if the guy who ends up maintaining your code is a violent psychopath who knows where you live.
Christian Clausen wrote:The important point I was making was: don't try to write perfect code in one go. Write imperfect but working code, then improve it once it is working.
However, I don't mind having to refactor 50 lines. The more code you have the more evidence you have for the structure the code is taking.
bryant rob wrote:I can remember just like it was yesterday when I posted some code that I was actually very proud of and Campbell replied real quick https://coderanch.com/t/732745/java/Sorting-array to let me know that a certain few lines of code belonged in a different method. To be honest I actually was kind of embarrassed at first... But, I realize it was not his intention to embarrass me, so I put on my coders face removed the code and created another method to distinguish between sorting and swapping. It made sense.
Junilu Lacar wrote:
To Christian's point, you're hardly ever going make code work and be well-factored the first time around. Or even the second or third time.
Consider Paul's rocket mass heater. |