An Unordered List of Small Tips for Programmers

A list of small Java tips. Image of 5 colored post-it notes in a row.

A while ago I was talking to a friend about writing this series of Java tips, and they expressed surprise that a technical tip could take up to a day or two to write.

“How about writing shorter tips?”, they suggested. “What, like "Remember Java is case-sensitive?"”, I replied.

That got me thinking. There are a few small tips that I often repeat while teaching that could be made into a list of tips, if not an entire post per tip.

Java is Case Sensitive

Obviously! Watch out for your spelling! Even one spelling mistake will make the compiler give you a zero grade.

It’s easier to remember the correct spelling when you use clear, self-documenting names for variables, methods and classes. Read my posts on naming things part 1, part 2 and part 3.

Use Javadoc comments to document your code. Keep your comments up to date. There are few things worse than outdated comments that confuse the maintainers of your code (and it’s probably going to be you for years to come).

Java is Free Format

Again, obviously! Use whitespace to your advantage. Make your code look good! Indent consistently! You’ll thank yourself (and me) when you’re called out at 2am to fix something in your code.

Viking with an axe about to attackUntidy, badly indented code is even worse than outdated comments! Write your code as if the person who’s going to maintain it is an axe-wielding psychopath who knows where you live.

Even though Java is free format, and it’s legal to write a class in a single really long line or a single really long column, don’t! Follow your company’s coding conventions. It will keep your boss happy. You do want a bonus at the end of the year, right? It also keeps your team members happy. Remember that psychopath with the axe…

Read the Fabulous Screen

Remember the acronym RTFM “Read the F… Manual”? I wrote a previous post about it. In the same way, read the fabulous screen.

When you’re developing code, read the compiler error messages carefully. Don’t just say to yourself (or someone helping you) that there’s an error. Read the message carefully. Pay attention to it. It will direct you to the exact line and column where the compiler thinks the error is. And the compiler will give you a detailed message. Read it a few times. Think about it. And again. And only then try to correct it.

Correct the first error first, and then recompile. Very often an earlier error will create a cascade of errors. Fixing the first one will generally reduce the error count by more than one.

Read your code carefully. Read what is actually on the screen, as opposed to what you think is there. It’s surprising how often we misread code, assuming that what we think we’ve typed is actually what we’ve typed. Often it’s not.

Read a Lot

I know this is a hard one for many programmers. Most software engineering and programming books and websites are written in English. If English isn’t your first language, reading is at best laborious, and at worst a Herculean task akin to cleaning out the Augean stables.

Try to read a technical book every month or two. If that’s too daunting, try for a chapter a week. There are a huge number of good books on programming and software engineering.

Start with “The Pragmatic Programmer” by David Thomas and Andrew Hunt. It’s an awesome book! It’s written in small easy to read sections, with each section being between two and ten pages long. There are a few sample chapters at their website. Start with those.

Read “The Mythical Man-Month” by Fred Brooks. It will give you an insight into software project management and the human elements of software engineering. It’s still as relevant and insightful as it was when it was written in 1975.

Read “Programming Pearls” by Jon Bentley. It will teach you to think like a programmer and become a better problem solver. Its focus is primarily on coding techniques and algorithms.

Read “Design Patterns: Elements of Reusable Object-Oriented Software” by the Gang of Four at some stage. It’s an excellent book, but more of a hard read than the others. The content is very technical, and the example code is written in C++ and Smalltalk.

For more book recommendations, see this list of 12 books and this list of 8 books. There’s a big overlap between my list and theirs.

Get Certified

In a crowded and/or unequal job market, having a formal qualification is essential. Programmer certification is also something to add to your CV. We know that studying for exams is hard work, but every qualification helps.

There’s a post on certification on our website.

Learn Other Technologies

Learn a few important Java technologies. Spring and Spring Boot are highly in demand. There is a growing need to have knowledge of container technologies such as Docker and Kubernetes.

SQL skills are essential for any database work. HTML is essential, and JavaScript is a close second for web development. Mobile app development is a growing field.

Build a portfolio of applications you have written. Keep your CV up to date.

Write a few small apps in your spare time in between reading books and studying for certification. What’s that you say? Sleep? Who needs sleep? 😉

Conclusion

With all that said, you still need to be a rounded person. Just sitting in front of your computer is definitely going to make you rounder, but not in a good way. The Internet won’t miss you. Switch off your computer occasionally. Go out with friends. Walk in the park. Play with your kids. Spend time on a hobby. You only get one life; live it and have fun!

Was this interesting? Please share your comments, and as always, stay safe and keep learning!

Leave a Comment

Your email address will not be published. Required fields are marked *

Thank You

We're Excited!

Thank you for completing the form. We're excited that you have chosen to contact us about training. We will process the information as soon as we can, and we will do our best to contact you within 1 working day. (Please note that our offices are closed over weekends and public holidays.)

Don't Worry

Our privacy policy ensures your data is safe: Incus Data does not sell or otherwise distribute email addresses. We will not divulge your personal information to anyone unless specifically authorised by you.

If you need any further information, please contact us on tel: (27) 12-666-2020 or email info@incusdata.com

How can we help you?

Let us contact you about your training requirements. Just fill in a few details, and we’ll get right back to you.