I have recently been working on a piece of very complex and very poorly designed code. It has been very difficult staying focused on the task at hand because I just can't keep everything going in my mind. I lose track of what path I was working on or how I got to a specific spot in the logic tree.
What can I do in this situation?
Unfortunately, I can't completely rewrite the entire section of code, even though it desperately needs it. Even if I was free to rewrite the entire piece of the system, I don't have a good enough understanding of it to be able to completely rewrite it without breaking it. I can, however, make changes to the code to make it easier to understand. I can accomplish this without changing any of the logic in the code. This will shrink down the amount of code I need to work with.
I can start by taking a piece of code and break it out into its own method. This new method will do nothing different than what it was previously doing. It will receive a name that will be descriptive of what it is doing. It will separate this code from the larger more complex whole. I can then better understand what this new method is doing while also making the larger method easier to understand and smaller.
I continue doing this, piece by piece until the original large function is broken down into many smaller functions. Every step along the way reduces the complexity of the original block of code and leaves me with a new method that I can understand more easily. I haven't changed anything about how the code works, but I have made it easier to understand.
When I find myself feeling frustrated trying to understand some new code, this is what I do. I stop trying to understand it. I break it apart and I turn it into smaller pieces that I can understand.
What can I do in this situation?
Unfortunately, I can't completely rewrite the entire section of code, even though it desperately needs it. Even if I was free to rewrite the entire piece of the system, I don't have a good enough understanding of it to be able to completely rewrite it without breaking it. I can, however, make changes to the code to make it easier to understand. I can accomplish this without changing any of the logic in the code. This will shrink down the amount of code I need to work with.
I can start by taking a piece of code and break it out into its own method. This new method will do nothing different than what it was previously doing. It will receive a name that will be descriptive of what it is doing. It will separate this code from the larger more complex whole. I can then better understand what this new method is doing while also making the larger method easier to understand and smaller.
I continue doing this, piece by piece until the original large function is broken down into many smaller functions. Every step along the way reduces the complexity of the original block of code and leaves me with a new method that I can understand more easily. I haven't changed anything about how the code works, but I have made it easier to understand.
When I find myself feeling frustrated trying to understand some new code, this is what I do. I stop trying to understand it. I break it apart and I turn it into smaller pieces that I can understand.
Casinos Near Harris, PA - Mapyro
ReplyDeleteFind 김포 출장샵 Casinos 양산 출장샵 Near Harris, PA in Pennsylvania near Harris, United States 경기도 출장마사지 and get 동해 출장안마 real reviews and 춘천 출장안마 ratings near Harrah's. Directions near me, PA.