How to write code you will love in the future

The thrill of writing our own consumed us, so we did it.

We built a project successfully with almost no libraries.

Always document and write code commentsThen came a twist to our story: the startup was eventually acquired.

I was moved to a new team.

The new members were more acquainted with libraries that exist in the market.

Suddenly our codebase was alien to them.

We indeed wrote our libraries, but we didn’t have enough time to document them.

It created a huge gap.

I learned the important lesson of documentation and code comments.

I realised code is not just about yourself.

As an author, it is your duty to write for the masses.

So the moral is, it is not wrong to write your own libraries.

But if you do, then documentation and code comments are a must.

Anyone should be easily able to comprehend your library just by reading your docs.

I can’t emphasize enough, don’t write for yourself!.As a code reviewer and maintainer, it is your responsibility to ensure this.

Don’t reinvent the wheelAs time passed by, I realized there was no point in reinventing the whole wheel.

Unless we have a lot of time to develop and document the same so that it can be understood by all.

If there is a library that exists and solves your problem, then it is a great idea to contribute to that specific project!.There is a catch, and I would like to quote from Phil Walton’s blog:Reinventing the wheel is bad for business, but it’s great for learning.

You may be tempted to grab that typeahead widget or event delegation library from npm, but imagine how much more you’d learn by trying to build those things yourself.

So make your choice wisely ^_-Always test your codebaseI can’t emphasize enough how important this is.

Thanks to libraries like Jest and React testing library, and many others, testing code has never been easier.

Often when the codebase becomes large, even a single line of change can cause the application to break.

If our testing is automated, we can be confident about the changes we push.

Keep learningI wanted my frontend development to be fast and performant.

I finally decided to learn React, mostly because of the background I came from.

I found it to be unopinionated, and writing it was very close to writing plain JavaScript.

It changed my life for the better.

Libraries like React, Vue, Angular and various others (especially Redux) don’t just tell you how to build a fast UI.

They also open doors to other concepts like functional programming, immutability, and many others, which actually helps you become better at your craft.

Learning React and Redux enhanced what I already knew.

ConclusionAs I gained experience, I eventually joined another startup, where I was tasked to build products from scratch and eventually lay the foundation.

But this time I was armed with all my experiences and mistakes.

I am happy to say, I am proud of what I have built so far and I am sure I have a long way to go.

The pursuit for perfection is a never-ending path, but we can always strive to walk the right path.

All the experiences I have mentioned are not meant to be the word of law.

They are very specific to my journey in the industry.

But I hope this will help you become a better developer, and I am always thankful to the community, who has helped me grow.

Follow me on twitter to get more updates regarding new articles and to stay updated in the latest frontend developments.

Also, share this article on twitter to help others know about it.

Sharing is caring ^_^.

Remember you can clap up to 50 times to shower your love!Some helpful resourceshttps://philipwalton.








org/wiki/Software_entropyMy previous articleshttps://medium.









com/what-i-learnt-from-reactfoo-2018-e4e1a4c6a705.. More details

Leave a Reply