SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Rewrite Your Code Tomorrow


Rewrite Your Code Tomorrow

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)

Group: Administrators
Points: 249285 Visits: 19809
Comments posted to this topic are about the item Rewrite Your Code Tomorrow

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Andy Robertson
Andy Robertson
SSC Eights!
SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)SSC Eights! (900 reputation)

Group: General Forum Members
Points: 900 Visits: 221
Another great article Steve, thanks.

We re-write a lot of stuff here. Time is the only critical/limiting factor. The benefits are clearer code that's more understandable, easier to change and maintain. Just taking the time to re-format and annotate code has benefits regardless of whether bugs are fixed or performance improved. Often when you re-format and annotate your code the issues or improvements that could be made become searingly obvious.
call.copse
call.copse
SSCertifiable
SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)

Group: General Forum Members
Points: 7424 Visits: 2089
Any short period of time between writing and reviewing will improve your code. I discuss this all the time with our devs and do my best to cajole them to revisit and tidy the structure up to little avail. No-one ever wants to look at code they have written that works while they still understand it sadly :-(

That said I think code standards have improved considerably overall in the last 5 years here so it's not all bad.
mjh 45389
mjh 45389
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2320 Visits: 1791
I would dearly like to revisit some code that works but could be better written and/or made more efficient. At the moment I am having to modify a program to add in something that was not in the original requirements. The structure is all wrong for the new feature but I do not have the time redo this and have said I feel like I am adding an illegal extension to a house! Sad

One of my big frustrations is maintaining somebody else's old code which was probably not reviewed, and because it worked lacks any sensible commenting!
chrisn-585491
chrisn-585491
SSCertifiable
SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)

Group: General Forum Members
Points: 5932 Visits: 2649
There's many projects I'd love to rewrite, but there's no time unless the rewrite fulfills a business goal. Just like programming languages, good-enough beats better...
LightVader
LightVader
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1673 Visits: 3134
mjh 45389 - Wednesday, October 4, 2017 4:43 AM
I would dearly like to revisit some code that works but could be better written and/or made more efficient. At the moment I am having to modify a program to add in something that was not in the original requirements. The structure is all wrong for the new feature but I do not have the time redo this and have said I feel like I am adding an illegal extension to a house! Sad

I have the same feeling. I have a project that I completed a few years ago that I would love to overhaul. I was learning a new development methodology as I developed the project and you can tell when you look at the code. The sections that I wrote towards the end of the project are significantly better than those I wrote at the beginning.

I also really like your analogy. I may have to borrow that one. BigGrin




The opinions expressed herein are strictly personal and do not necessarily reflect the views or policies of my employer.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)SSC Guru (249K reputation)

Group: Administrators
Points: 249285 Visits: 19809
Good comments, and thanks. Note, I'm not looking to rewrite an entire project or a huge section. Just rewrite the code (or some of it) from yesterday.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Eric M Russell
Eric M Russell
SSC-Forever
SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)

Group: General Forum Members
Points: 48358 Visits: 12286
Even the best developers can write bad code when they're under the influence of adrenaline, sleep deprivation, and poor requirements. Just like professional authors have editors, it helps to have another developer (perhaps a specialist) who can review your code and tidy it up in terms of sanity checking, performance optimization, and commenting.


"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Rod
Rod
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12256 Visits: 2283
chrisn-585491 - Wednesday, October 4, 2017 6:01 AM
There's many projects I'd love to rewrite, but there's no time unless the rewrite fulfills a business goal. Just like programming languages, good-enough beats better...


Unfortunately, this sometimes is very true. There's been several projects I wanted to improve and ordered not to. It really is "good enough beats better".

Kindest Regards,Rod
Connect with me on LinkedIn.
Rod
Rod
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12256 Visits: 2283
Great article, Steve. More often than I care to say, I've come across old code and asked myself what cretin wrote this crap, only to discover that it was me.

This article reminds me of one of the test programming websites (I think its CodeKata) that actually encourages you to come to their website, take one of the short problems, solve it. Then a week or so later go back and solve the same problem again, but in a different way. It really is worth your time.

Kindest Regards,Rod
Connect with me on LinkedIn.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search