DEV Community

Cover image for Becoming a Better Programmer with a Chronometer
Alexandro Castro
Alexandro Castro

Posted on

Becoming a Better Programmer with a Chronometer

An article for people who want to become a better developer
You care about code. You're passionate about programming. You're the kind of developer who likes to craft truly great software. And you're reading this article because you want to do it even better. Good call. 👌

3 Months ago, april, 2021, I started a project called Chronometer React, to help my brazilian friend to improve his ability to code, and learn about some tools like: Contexts, Hooks and TypeScript. We had started this small project, and about ~4 days it was done. Great! 
What we made? A Simple UI that just start, pause, and reset chronometer.

This small project were enough to understand some concepts, and we realize our aim.
Should we improve this project, even though we have accomplish our aim?

It depends. In my case, this is just one more hundreds project i've made. but if you need to build a good project, good enough to impress a Technical Leader who's looking for a awesome developer!? or you are just trying your first job? or do you have a loadsa unfinished projects ?

Pretty early in any programmer's career comes the realisation that there's more to being a great coder than a simple understanding of syntax and a mastery of basic design. The awesome programmers, those productive people who craft beautiful code and work effectively with other people, know far more.

I realized that for me it was not enough. So, i start to improve this project, coding some features like:
Offline first with Service workers (PWA)
Implement a editable table with laps.

Maybe you think… 

Well, okay. good job! You've dedicated too much time in it.

3 months after built it, i realized that it's not enough for me. Let's improve it more! But how should we ?

First - Being an user
 I stop using my Apple Chronometer, and started to use my chronometer. Guess what i found ? A interesting bug !

If you don't know, Google Chromer 57+ [and others navigation], stop running workers like setInterval when tab is inactive, just to optimize CPU usage.

And it make all sense, of course! We needn't this to increase second a second.

Second - Remove useless logic, and refact.

If useless, remove it so.
Remove useless logic, and refact it.

In this case, i chose [It's opcional, you can do it in your own project] to build a package just to handle with Chronometer basic functions, and just consume it in my App.

And after publish my package in NPM, i wrote all documentation in portuguese and english [It's opcional too, but a good package have support and must be understandable]

Third - Write tests
I noticed that some functions are dumbly and stupid wrong. Like start chronometer twice, or pause / reset, before start. 

Look at the tests. Test successul and exceptions. Work out how to add a new unit test, and how to add a new test file to the suite. How do the tests get run? A great trick is to try adding a single, one-line, failing test. Does the test suite immediately fail? This smoke test proves that the tests are not actively being ignored.

You should learn about TDD well.

Fourth - Learn by Doing
You can continue reading article as you like about the theory of riding a bicycle. You can study bicycles, take them apart, reassemble them, investigate the physics and engineer‐ ing behind them. 

But you may as well be learning to ride a fish. Until you get on a bicycle, put your feet on the pedals and try to ride it for real, you'll never advance. 
You'll learn more by falling off a few times than from days of reading about how to balance. 

It's the same with code. Reading code, Unit test, End2End tests, User expericence, call stacks and etc, will only get you so far. You can bacome a [better] developer by getting on it, by trying to ride it, by making mistakes and falling off. 

Don't let inactivity prevent you from moving on. Don't erect an intellectual barrier to prevent you from working on the code.

Don't be so apathetic ! doesn't matter your carrear, apathetic people are who they are, just apathetic. 
If you think that something can be better, go ahead and become a great professional.

Insights - How i became a better developer with a chronometer app ?

  • I wrote my first english article
  • I wrote my first documentation ( Multi language )
  • I wrote my package with documentation
  • I improve my technical skills to test codes
  • I improve my technical skills to refact code
  • I improve my technical skills to write in english

I hope to inpire you to be better, have a nice day 👋

Top comments (1)

aonemd profile image
Kuroi Vimmer

Kudos for sticking to the project and working on it all this time!