Post

Clean Code/ Refactoring/ Secure Coding

✅ Clean Code

code with better readability

  • method naming
  • no error
  • no repetition
  • dependency ❌
  • one function per one class/method
  • adequate spacing between functions
  1. Naming

    use explicit names for variable, class, method

  2. Comment

  • only comment when necessary
  1. Aesthetics
  • adequate indent, spacing
  • simple, repeated patterns
  1. Making control flow easy to read
  • left: variable, right: number if(length>10)
  • use true than false if(a == b)
  1. Function
  • smaller the function, better
  • one job per function

✅ Refactoring

legacy code 👎🏻 ➡️➡️➡️➡️➡️ clean code 👍🏻
better code, maintaining the same functions
make software better understandable, easier to maintain
>

code inspection

check already developed code to update to cleaner code

  • remove repeated code
  • long methods
  • huge class
  • swtich👎🏻 override👍🏻
  • refactor prodedral programming(절차지향)

✅ Secure Coding

elminiate potential risk in code

  • SQL injections
  • URL parameter
This post is licensed under CC BY 4.0 by the author.