Writing a "beautiful" code is worth it. Why?
Opening the menu of any restaurant / bar / cafe, what do you do first? See the pictures. You determine for yourself: whether you like the dish, whether its composition is clear, whether a large portion, whether it will be enough. Agree: if some strange substance, even hypothetically tasty, is brought to you, the first reaction is distrust.
So with the code: looking at it, you will want to understand its algorithm, evaluate how the program will behave in a particular case, where it is necessary to make certain changes.
In a long and inaccurate code, you can mess around for a very long time – you will lose time, nerves, strength, and there is no guarantee that everything will work out.
A professional programmer clearly knows what and for whom he writes, what task this code should solve, even if the only requirement of the customer is “to work”. The code should not be impressive, it should be understandable, unambiguous, specific, predictable in the future. Such code is much easier not only to support, but also to optimize and fix if necessary.
The names of variables and methods play a large role, since they greatly simplify the reading of code. Achieving the same goal, but significantly less code, makes it more reliable. Comment, but do not get carried away. Do not design too much, start from a specific task. Track bugs.