Git Product home page Git Product logo

coding_tips's Introduction

How to write better code?

Being a programmer is not only about writing code that works, but also about writing better code. You should not only write quality code but also make it right as you go along. OR you can do it as soon as you finish the task.

Be a good writer

Write better comments

  • For vague lines of code, write a single line of comments.
  • For tricky logics or blocks, write descriptive comments.
  • Don't assume everyone can understand your code.
  • Don't forget, keep your comments up to date.

Be a good doctor

Code Refactoring

  • The top most habit of highly effective developers is code refactoring.
  • Do you have good health in your code? If not, keep it healthy.
  • Your methods, functions, variable names, and the number of arguments a method receives should all be refactored.

Be a standardised

Use a coding standard

  • It's easy to write code, but hard to maintain and understand. By following a standard, your code will always be deterministic, regardless of the code type.
  • It's not necessary to follow an existing standard, you can create your own.

Be a meaningful

Use meaningful names

  • Be sure that variables, methods, classes, files, etc. have meaningful names.
  • You should avoid using short names, because they might be difficult to understand by others.
  • Use a consistent naming scheme, such as camelCase or Underscore.

Be a manager

Use a system of code backup

  • If your code wasn't backed up or your system wasn't working due to an error, what would you do?
  • Make it a habit to push your code to a distributed system like Git.
  • A distributed version control system (git) will simplify your life.

Be a reviewer

Code reviewing

  • Code review is always a good thing for coders. You should always review other skilled developers' code on Github. You will get to learn so many things.
  • Offer to let other members of your team or other people review your code. Just note down all the feedback and follow them as much as possible. Trust me, it always makes your code better.

Other tips

Don't repeat code

Whenever you have code that will be used more than once, it is better to separate it into a class or file.

Don't write long functions

Writing long functions is very difficult to read and understand. Keep functions short as much as possible.

Organize directory structure

Most of the projects do have lots of files and resources. It's good to have to organize all the files into smaller groups according to sub-modules.

Delete unused code

Don't keep unnecessary code in your main working project. If such code is not required, just delete it or keep it somewhere else.

Pro tips

  • Use a design pattern
  • Avoid global code
  • Use automated build tools
  • Use Testing framework
  • Use Code Documentation
  • Contribute to open-source projects
  • Accept challenges and do them.
  • Improve logic by solving problems daily.
  • Always keep patience

Hope you find this repository useful. Do not forgot to follow me for more updates.

Contact Me:

Feel free to reach out if you have questions or if you want to contribute in any way:

coding_tips's People

Contributors

nitiniosdev avatar nitin-agam avatar

Stargazers

Harpreet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.