As an engineering student, coding should be your hobby, but you should tackle it with the right approach. Instead of writing mountains and mountains of code with endless loops, you should try to write clean and readable code from the get-go. To also write efficiently and save time, do not forget to learn about AI tools that help you code faster. Good coding habits will help you be ready for the jobs and land projects that are futuristic and creative.
Here are the best Coding habits for engineering students!
Writing Clean and Readable Code From Day One
Writing clean and readable code from the get-go will save you a bucket of time in the long run. Do not fall into the trap of writing rushed code that gives you a headache afterwards while compiling.
- Avoid the "Monster Code" Trap: Instead of writing massive blocks of code with loops inside loops, break it into smaller sections.
- Name things what they actually are: Don't name a variable x or data2. If a variable holds the average temperature of a sensor, name it average_temperature. It may look like a small thing, but it will make a huge difference.
- Let your editor format for you: Every modern code editor has an auto-format button. Use it. It instantly fixes your spacing and indentation, making your code look professional.
Master the Tools of the Trade (Beyond the Code Editor)
A good developer not only writes good code but is also handy with the tools that help him code better.
- Learn Git (Version Control): Imagine a system that takes a snapshot of your project every time you hit a milestone. If you break your code at 2:00 AM, you don't have to hit "Undo" a thousand times—you just roll back to the last working snapshot. It replaces saving files as project_final_v3_REAL_FINAL.py.
- Get comfortable with the Command Line: It looks like a scary, old-school hacker screen, but navigating your computer using text commands is faster and essential for almost all engineering jobs.
- Pick one editor and learn its shortcuts: Whether it is VS Code, PyCharm, or something else, learn the keyboard shortcuts. It keeps your hands on the keyboard and keeps your brain in the zone.
The "Think First, Code Later" Approach
Before writing or typing anything, you need to first think through your code.
- Try Plain English: Instead of focusing on writing the actual code, you can write out your logic using English. For example: # 1. Read data from file, # 2. Filter out negative numbers, # 3. Calculate the average. Once the logic makes sense, just fill in the actual code underneath.
- Break it Down: Instead of building an entire project in one night, try to focus on one feature first. Build a feature accurately first, and then move on to the next.
- Do not copy-paste: You can take help if needed from the internet, but try not to copy and paste an entire code. If you do, ensure that you understand every single line before you paste it into your project.
Debugging and Testing Like a Pro
A code giving out an error is the most common thing that happens to a developer or an engineer; it has nothing to do with your experience.
- Never Panic: When an error message shows up on your screen, your first instinct should be to check what went wrong. To see your wrong step, read the very bottom line of the error.
- Print Statements: If your math is coming out wrong, print the variables at different steps of the calculation. See exactly where the numbers stop making sense.
Documentation: Writing for Your Future Self
Documentation is the fastest way to remember what you did last week since, after you are done with your project, it may seem possible to go back and see what code you used or what logic you applied where.
- Explain why, not what: Don't write a comment like x = x + 1 # adds 1 to x. Instead, write x = x + 1 # skip the header row in the spreadsheet.
- Write a short README file: Every project should have a simple text file explaining what the project does, how to run it, and what tools are required to make it work. It is the first thing people look at on your GitHub profile.
Continuous Learning and Community
It always takes a village no matter what job you do and how lonely you feel while doing it; you always need a community to build support and take suggestions whenever needed. Sometimes, an error that is not visible to you is visible to others. You can take suggestions and advice to help develop better projects eventually.
- Show your code to others: Ask a classmate to look at your code, and offer to look at theirs. You will be amazed at how quickly someone else can spot a typo that was invisible to you.
- Build things outside of class: Class projects are essential for learning, but building personal projects is what helps you unleash your creativity. You can build a simple budget tracker, a script that automates a boring task, or a basic video game.
- Aim for short-term goals: Instead of aiming to learn an entire language, try to build and aim for small targets that feel achievable. You can start by learning one new shortcut, one new function, or one better way to organize your files. At the end of the day, you will be left with a whole new set of skills and knowledge along with your degree.
If you are an engineering student, you make coding a habit. Try to develop skills that will help you to create an outstanding portfolio needed to land the right jobs and projects.