12 Practices That Make You a Good Programmer

DZone 's Guide to

12 Practices That Make You a Good Programmer

What do you know about how to become a good programmer?

· Agile Zone ·
Free Resource

What do you know about how to become a good programmer?

What do you know about how to become a good programmer?

One common misunderstanding is that one has to know a lot of programming languages and tools to be a good programmer. This is untrue. Keep reading and I’ll show you why.

Today I’d like to share my own experiences.

You may also like: The Good and the Bad of Java Programming

1. Studying Data Structures

As computer scientist Niklaus Wirth said in his well-known statement:

“Data Structures + Algorithms = Programs”

Data structures are the building blocks of a computer program. Imagine they are bricks that make up a house. Indeed, data structures decide how fast and efficient program solves problems. For example, given the same problem, one program can perform faster than others because it uses more appropriate and efficient data structures. Also, using the right data structures make the solutions become simpler and save development time.

So how should you study data structures?

First, pick a good book to grasp understandings about how data structures are designed and perform. I’d recommend the book Data Structures and Algorithms Made Easy by Narasimha Karumanchi. It is C/C++ version, and you can find its Java version here.

Second, try to implement some data structures from scratch, e.g. list, stack and queue. You will not only understand deeply how they work, but you also improve your coding skills by “re-inventing” these data structures.

Third, experiment with the built-in data structures provided by your primary programming languages (for Java, it is the Collections framework) to comprehend which one is used for which purpose. For example, using lists for fast access to elements by index; using sets for random order of elements; using queues for producer-consumer processing, etc.

Fourth, always spend time to think and choose the most appropriate data structures that can be used to solve problems before writing code. Remember, don’t re-invent the wheels, always take advantage of the existing data structures provided by the programming language you use.

Having said that, I’d recommend you spend enough time, as much as possible, to master data structures at first.

2. Studying Algorithms

Good programmers are always good at using proven algorithms and writing new ones. While data structures abstract the inputs and outputs of problems, algorithms decide how the problems are solved.

Perhaps algorithms are the most difficult topics to learn in programming, as they do not only require good logical thinking, it also requires mathematics capabilities. So if you can manage yourself to be good at algorithms, you will stand out from the crowds.

The good news is that we don’t have to invent algorithms from scratch, as our ancestral programmers already did the hard work. So we just learn to use the proven algorithms. I’d recommend you at least grasp understandings about the fundamental algorithms: sorting (quick sort, merge sort, etc), binary searching, recursion, graph exploration, greedy and basics about cryptography. Also, you need to understand the algorithm complexity — the big O notation.

How Should You Study Algorithms?

In addition to the aforementioned data structures book, I’d recommend you pick the book Introduction to Algorithms to get the concepts and implement some well-know algorithms from scratch. Better writing programs that simulate how algorithms work. For example, write a program that visually shows how the quick sort algorithm works. I bet you will learn many things and have your coding skills improved significantly by doing this.

Let invest enough time to become proficient at algorithms, you will be unbeatable!

3. Studying Design Patterns

Programming is finding solutions to problems; however, the solutions also face its problems, such as the need for better performance, more flexible design, more reliable architecture, and fewer errors and less potential bugs. Thus design patterns are proven solutions to solve common problems in software design.

To become a good programmer, you should be able to apply design patterns to your program’s technical design. Using design patterns helps you write software programs that are reliable, flexible, maintainable and fewer bugs.

How Should You Study Design Patterns?

There’s a lot of books out there, and I’d recommend you start with the famous book Design Patterns: Elements of Reusable Object-Oriented Software (C/C++ implementation). For a Java-friendly version, I’d recommend Head First Design Patterns. You should manage yourself to be well-versed in the foundation design patterns such as factory, builder, strategy, command, template, façade, visitor, and singleton.

Make a plan to study design patterns by following the aforementioned books and write a lot of code (a lot of code) to experiment and test each pattern until you actually understand and confidently apply design patterns into your program’s design.

4. Reading Books

How many programming books do you read every year?

If your answer is less than three, blame yourself for not being more active! Good programmers are always hungry for content, and I’d recommend you read at least five books per year. Many books are collections of wisdom that can open your mind, help you learn faster and show you how to do things in the right ways, not just “works”.

Which Books Should You Read?

Always find the must-read books and read them first.

I’d recommend the following must-reads:

For Java programming, Effective Java is a must-read.

So now, let make a plan to read these excellent books one year from now.

Remember this when reading: Don’t read a book from cover to cover. You won’t have enough time and patience for doing so. It’s smarter to read only what you need first, and then read other sections when you have time. For example, if you need to apply the Strategy pattern, focus on reading the chapter about that pattern; if you need to write a servlet, focus on the chapter about servlet.

Also, remember to take notes and take the exercises seriously, so you won’t waste your valuable time in reading.

5. Reading Blogs/Magazines

Blogs are always more up-to-date than books, as the authors tend to keep their readers posted. Find an authority blog/website in your niche and stick with it, e.g. reading a new post every week to update yourself with today’s fast-changing technologies.

I’d recommend DZone — a site that originally starts as a Java developers community, and now it becomes one of the web’s largest community for software professionals. You can find on DZone a lot of helpful articles, insights, and advice on almost categories of programming, from Java to Javascript, from web development to the Agile method, from big data to cloud computing, etc.

Also, find magazines that are specialized in your niche. For Java, I’d recommend you to read Java Magazine — a bimonthly publication issued by Oracle - the steward of Java technology.

So to keep yourself always updated, read a new blog post every week and read a magazine issue ever one or two months.

6. Using Unit Tests

“Write tests first, write code later” is what I want to tell you to do in your programming projects. Requirements are translated into very specific test cases, you then write code to implement business logic and make sure they pass all the tests. You write code to test every method of a class and every class of a program.

You know, unit testing has been being adopted widely by programmers as it has many benefits such as finding problems early, facilitating changes and refactoring, simplify integration testing, providing live documentation of the system, etc.

Unit testing leads to the emergence of Test Driven Development (TDD) methodology. TDD is employed by many programmers in many programming languages.

How Should You Study Unit Testing?

I’d recommend you to read The Art of Unit Testing — this is an excellent book about unit testing and TDD. For Java, you should start with JUnit — one of the most popular testing frameworks for Java development.

So if you haven’t used any unit testing frameworks, you are missing a powerful tool in software development.

7. Doing Freelance Projects

One of the fastest ways to improve your coding skills and become a good programmer is working as a freelancer (either part-time or full time). In short, freelancing means that you find projects online, work from home and get paid online, too. The cool thing is that you can choose what kind of projects you love working with (desktop, web app, mobile app, design, writing, testing or even hardware projects).

This allows you to develop and expand your experiences in various areas which makes you always feel exciting and challenging.

In contrast, working for a company may be boring as you may have to follow one project all the time. This might be an obstacle to diversify your experiences.

Doing freelance is not easy at all. It requires working hard because the freelance market is highly competitive with thousands of freelancers seeking jobs. It’s better to keep your current job and start freelancing gradually.

How Should You Start Doing Freelance?

Well, I’d recommend you start with Freelancer.com which is one of the largest freelance markets where you can find almost any kind of job. I’ve been working on this site since 2009 and have done 142 projects with an average rating of 4.8/5 — that brought to me a variety of experiences.

8. Doing Side Projects

If you don’t like doing freelance projects, you can specify some interesting projects and work on them in your free time. Working on your projects helps you improve your skills in all phases: coding, testing, designing, documenting, deploying, etc. This gives you vast experiences of the whole process of software development, in contrast to working in a company where you may involve in only the coding phase.

How Should You Start Doing Side Projects?

My advice is “Start Small First”. Don’t go with big projects from the beginning, as you won’t have enough resources and experiences. So it’s wise to start from small projects, then with bigger, bigger ones gradually. And remember to manage yourself to complete each project within a period of two or three months.

9. Participating in Programming Contests

Perhaps this is the most challenging way to develop yourself to become a good programmer. As when you join a contest, you have to devote your time and resources, and high focus on the development. This helps you a lot in terms of improving your programming skills.

Remember that prizes do not matter. The only thing does matter here is how you grow yourself during the contest. I was participating in a couple of contests (a mobile app and a desktop game) without getting any awards; however, I admit that I learned a lot when I was working hard to submit the programs before the deadline.

There are some well-known programming contests you can try: Imagine Cup from Microsoft; ACM-ICPC sponsored by IBM, and TopCoder. The first two are for students and the last is for all programmers. Also looking for contests organized by local companies in your country.

Don’t be afraid that you don’t have experiences to join a contest! Just sign up and the rest will follow. Be brave!

10. Conducting Code Review

Code reviews should be taken place regularly in your team. Let other programmers review your code, and give reviews on the code of others as well. Being reviewed forces you write better code and reviewing the code of others helps you learn the pros and cons of others.

I’d recommend you to use a code analysis tool like Sonar Qube — this tool scans your entire codebase and produces detailed reports based on various code quality standards. You fix your code until the tool no longer reports ‘red alert’. Some code analysis tools can be integrated with your IDE (Eclipse or NetBeans) nicely, which makes code review more naturally.

I strongly encourage you to conduct code review sessions in your team regularly with the assistant of a code analysis tool.

11. Reading Code

This is different than reviewing code. I’d suggest you spend time to read the code of other programmers. You will learn a lot through this process because no one writes code exactly like you, especially code written by experts for well-know products. If you give a problem to 1,000 programmers, there would be 1,000 solutions written in 1,000 ways. You will find creative solutions which you have never experienced before.

For Java, I’d recommend you start reading the source code of the Java Collections framework (you can find it inside the src.zip file which is under JDK’s installation directory). Also try to read the code of popular frameworks like Spring, Hibernate, Struts, etc.

12. Teaching About Programming

“The best way to learn is teaching” - You can record videos, write articles, create books or organize a programming course to help others learn about programming. Teaching is a great way to learn because when you teach, you tend to study everything related to the topics, in contrast to coding in which you tend to just make the code “works”.

I strongly recommend you to choose a favorite way to begin teaching, as I’ve been doing so since 2012 when I wrote Java tutorials for some programming websites before creating my site CodeJava.net and my Java Youtube channel. I also created some Java courses on Udemy.

So if you haven’t taught anything, it’s time to think about it.

So far I’ve told you the 13 activities you can practice to develop yourself become a really good programmer. This is solely my own experience, so I’d very happy and welcome your comments.

Which of the above ways you are currently doing? And what would you add to the list?

Further Reading

You're a Bad Programmer. Embrace It.

10 Tips on How to Be a Great Programmer

agile ,programmer experience ,programming book ,programming for beginners ,programming practices ,programming-skills

Published at DZone with permission of Nam Ha Minh . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}