How to write code that follows industry standards

Hi i am a new member in this forum. How do i write code like a professional, i am currently in my 3rd semester btech .I am not sure that whether my code is good or bad .
Is there any place i can ask or see codes that follow industry standards? i have tried code review but it isn’t working for me.
any suggestions?

The term you probably want to search with is “best practices”. You can find books, articles, and blogs by industry professionals about coding guidelines and why they exist.

ok i’ll try it.
Thanks.

From my industry experience, here are some coding best practices to follow:

  1. Reusability: Reuse code as much as possible. In Object Oriented programming, this is well taken care of. Also, write reusable functions or any kind of shareable code, fir example, external stylesheets for css instead of inline or internal styles if many elements across multiple pages would follow the same style.

  2. Indentation: Indenting your code improves readability for yourself and others.

  3. Comments and Documentation: Documentation of any kind is helpful be it a project or a feature/enhancement to an existing app. Also, commenting blocks of code as and when you program is a good habit. It helps other programmers make out at a glance what this piece of code does without having to go through each and every line of it. It helps yourself too in case you revisit it after a long time.

  4. Version control: helps to keep track of every version and changes to your code without the risk of losing it.

  5. Learning and continuous improvement: Try to explore the programming language as much as you can to make use of its built in functions and libraries and stay on top of its updates.

1 Like

Great question, I highly recommend to learn about “Test Driven Development” by watching YT videos.

Also if you Google TDD there is tons of material availble.

IMO any code backed by tests is the best quality code, which is easy to refactor and fix in the middle of night as well.

Also don’t worry about perfect code, it doesn’t and never exist.

Do checkout book https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/

I’ve looked around several times for textbooks and courses on TDD and every time there has been a massive lack of material on those topics, and anything found was of low quality or outdated.

YT is the best school in the whole world, there are lots of most upto date and detailed video tutorials available on TDD.

If you wish to involve everyone in building “Quality” software then “BDD” is the best approach which involves project stake holders aks product managers, developers and others like QA, marketing etc

Understand, discuss and write down user stories in plain English ( which primary school student can understand as well ) before writing a single line of code.