How to be a great software developer is a looong read, but it's worth reading, since it contains lots of truths.
Refactoring is by far the most underevaluated technique of working. I mostly get the impression we like to rewrite and start on the green field. But how can the (mostly hidden) value that is there in some source code survive if we throw it away? Therefore ...
Start with something ugly but functional and then apply and reapply yourself to that ugly and misshapen solution and refactor it back into its simplest form.
And the goal of refactoring is to make the thing the source does simple.
Simplicity comes far more reliably from work than from brilliance. It comes more predictably from code written, than from thought expended. It comes from effort.
Go learn how to write better code, if you can't learn how to make the ugly code you wrote nicer.
Your code has two functions: the first is its immediate job. The second is to get out of the way of everyone who comes after you and it should therefore always be optimised for readability and resilience.
Lazily written code slows you down, increases cycle times, releases bugs and pisses everyone off.
Just discussed the last two days what are the right tests to write, etc. and here comes the summary in short:
There is no intuitive answer to what the right amount of testing is. Take the time to understand what really needs tests and how to write good tests. Take the time to see when tests add value and what the least you need from them really is.