If The Code Works, Don’t Touch It !

This is a repost with little modifications of a post originally in my blog.
zairiaimen.com
If you don’t want to read the post, you can also watch the video version of it :

The sentence “if the code works, don’t fix it” is sometimes taken as a rule …


This content originally appeared on DEV Community and was authored by Aimen Zairi

This is a repost with little modifications of a post originally in my blog.
zairiaimen.com
If you don't want to read the post, you can also watch the video version of it :

The sentence “if the code works, don’t fix it” is sometimes taken as a rule by newbie developers. Though most of the times it works, i Personally think it is just an excuse from lazy developers.
What is even a bigger problem are people who learn frameworks without learning the basic concepts which causes them to write spaghetti code, and when they see this "Rule" they think it's something everyone does.

Why You Should Fix Your/The Code

  • Becomes more readable by other
  • Improve the code
  • Improve the code
  • having testable
  • having extensible code

When To Not Touch The Code

  • New To The Job
  • Not Experienced Enough With The Technology
  • A Part Of the Code That Won't Change Over Time
  • Usage Of Open/Close Principle ( Add New Features Without Removing The old Ones )

How To Fix

  • Read The Code Multiple Times Until You Understand It ( We All Know that our old code can only be understood by GOD but still give it a try )
  • Separate Logic From State / UI Management
  • Use Design Pattern To Turn The Logic Into Small Testable and Extensible Pieces.


This content originally appeared on DEV Community and was authored by Aimen Zairi


Print Share Comment Cite Upload Translate Updates
APA

Aimen Zairi | Sciencx (2021-11-03T13:33:27+00:00) If The Code Works, Don’t Touch It !. Retrieved from https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/

MLA
" » If The Code Works, Don’t Touch It !." Aimen Zairi | Sciencx - Wednesday November 3, 2021, https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/
HARVARD
Aimen Zairi | Sciencx Wednesday November 3, 2021 » If The Code Works, Don’t Touch It !., viewed ,<https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/>
VANCOUVER
Aimen Zairi | Sciencx - » If The Code Works, Don’t Touch It !. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/
CHICAGO
" » If The Code Works, Don’t Touch It !." Aimen Zairi | Sciencx - Accessed . https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/
IEEE
" » If The Code Works, Don’t Touch It !." Aimen Zairi | Sciencx [Online]. Available: https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/. [Accessed: ]
rf:citation
» If The Code Works, Don’t Touch It ! | Aimen Zairi | Sciencx | https://www.scien.cx/2021/11/03/if-the-code-works-dont-touch-it/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.