Do this one thing if you want your code quality to improve
A relatively junior developer

Do this one thing if you want your code quality to improve

More often than not, modern day Software Development is not about conceiving algorithms or thinking through complex systems scenarios on a daily basis. Unless you work in a novel systems team, odds are that you will be asked to use Frameworks, APIs and SDKs built by others. This implies trying different alternative iteratively before you finalize your solution. This becomes very true with Data Scientists as we spend a majority of our time writing plumbing code to wrangle data. Since it is hard to conceive beforehand the kind of data the model would require, rapid prototyping is essential to run many iterations before finally arriving at an appropriate structure of the data. This means experience may teach you to trade of fast prototyping to good coding standards. In the past, this often resulted in me writing less desirable code (knowing that I may have to throw all of it away and star over) and spending cycles on refactoring. Eventually, due to the reinforcement of cutting corners, I began to spiral down a path of iteratively worse code and once I reached the final model, I had to spend cycles working to bring my code to production quality. One of my co-workers who has more Software Engineering experience than I do, never seem to suffer the agony of spending cycles to improve code quality; it just took him one iteration all the time. So I probed him over lunch for his secret sauce and he said he would send me a code snippet that would make my code better. So after lunch, I peeked into my inbox and he sent me this:

if(you.require(GoodCode))
{
  you.write(UnitTest); //and as you write the code, test
}

It changes everything

Once I started writing unit tests, my code improved tremendously. I started thinking naturally in the lines of functionally independent modules as I had to write code chunks that were independently testable. In other words, I inadvertently modularized my code. As an example instead of writing a specific cache for my purpose, I wrote a generic templatized cache (that I reused in multiple iterations). Since I have unit tests, adding features to these modules means I could catch regressions easily. Now, I even have my own small suite of class libraries for data scrubbing that I reuse across projects. It is entirely possible that I was the only one to suffer and learn in this business of fast prototyping; if not, I just wanted to share this one tip that changed my perspective.

Kamaleshwar BN

A fullstack webdev / lead

7 年

Hey, you write neat stuff ^_^ P.S: I noticed a typo `(knowing that I may have to throw all of it away and **star** over)`

回复

要查看或添加评论,请登录

Aadharsh Kannan的更多文章

  • Decoding Tech Executive Roles: Who Does What in Digital Leadership?

    Decoding Tech Executive Roles: Who Does What in Digital Leadership?

    In today’s rapidly evolving tech landscape, leadership roles have become increasingly specialized, often blurring the…

  • Evolution of Humanity's Codex: Language, Math, and now AI

    Evolution of Humanity's Codex: Language, Math, and now AI

    Human beings initially invented language as a tool to communicate complex phenomena—social structure, norms, customs…

    1 条评论
  • Wetware, the future of AI?

    Wetware, the future of AI?

    While advancements in AI have recently dominated news cycles, few were paying attention to decade-long tectonic shifts…

    2 条评论
  • Community underwriting, a test for ubiquitous credit access?

    Community underwriting, a test for ubiquitous credit access?

    Alan Turing famously proposed the imitation game, a test to gauge a machine's ability to exhibit intelligent behavior…

  • Future of Data Science at Scale

    Future of Data Science at Scale

    In the early years of Hadoop, there were only three companies seriously using it. Today, it is an ubiquitous phenomenon…

    4 条评论
  • Microsoft, a dream come true

    Microsoft, a dream come true

    In the Spring of 2009, I was the only one seated in the lobby of a secluded high roof building in the tropical South of…

  • Information Worker's Occupational Hazard

    Information Worker's Occupational Hazard

    In the early days of commercial ship building, workers often got hit in their head with spanners and wrenches falling…

  • Fresh Data Scientist from Academia ?

    Fresh Data Scientist from Academia ?

    Increasing number of individuals from post-graduate and doctoral studies ( with no prior work-experience ) are entering…

  • How to model world trade ?

    How to model world trade ?

    One of the first things we learn in Economics is to take a passive observation of the world and try to explain it with…

  • A Data Scientist falls in love with Stan

    A Data Scientist falls in love with Stan

    First things first, a quick introduction to structural modeling for those unfamiliar with the term. Some Machine…

社区洞察

其他会员也浏览了