0

How to ship a bug free code for urgent and 1 time usage?

Profile picture
Mid-Level Software Engineer at Startup7 months ago

I am a mid-level machine learning engineer in the advertising field, and I often need to provide PMs with performance numbers that are not available in the dashboard so that they can communicate with clients or make business decisions. Sometimes this need is urgent, such as needing to write code to find the number of customers who made purchases in the past seven days that meet a certain condition within half a day to a day.

I have encountered a few problems:

  1. The conditions are different each time, and the code is difficult to reuse. I am not sure if it is worth investing time to write unit tests. Is there any way to make sure my code is bug-free?
  2. Sometimes the calculated numbers do not seem intuitive, and I am worried about providing wrong numbers, so I spend extra time checking them, but I am also told that it takes so long to calculate such a simple thing. Indeed sometimes the code itself is not difficult to write, but the main time is spent verifying the correctness of the results. How to communicate this?
  3. Sometimes I ask my colleagues to help me check my code or results, but I am worried that my manager will think that I cannot complete my work independently and that I am not meeting the company's expectations of a mid-level engineer.
39
2

Discussion

(2 comments)
  • 0
    Profile picture
    Eng @ Taro
    7 months ago

    I often need to provide PMs with performance numbers that are not available in the dashboard so that they can communicate with clients or make business decisions. Sometimes this need is urgent, such as needing to write code to find the number of customers who made purchases in the past seven days that meet a certain condition within half a day to a day.

    I do believe there's an opportunity for making all of these metrics available in the dashboard so you don't have to write these one-off scripts. You mentioned that you have to provide PMs with this data very often. By allowing PMs to query this data themselves, you will relieve the burden of writing these one off scripts for PMs with urgent timelines, and it will allow PMs to go through a self-serve dashboard themselves. This will move the urgent timeline to them, and it will relieve the work off of you. Making these metrics available to everyone in the dashboard is more of a long-term project, but I think this approach is best for the company because of the flexibility and time it will save.

    In the short-term, you can meet with the PMs/engineers and go over the queries you wrote so everyone can agree that the query and numbers look correct. The query accuracy should be a shared responsibility (esp. if the numbers are going to be used in an important way), so the responsibility doesn't fall solely on you.

  • 0
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    7 months ago

    It is strange to me that you have to repeatedly write code to provide data. In general, analytics should work like this:

    1. You log events from the business application (this will take code initially)
    2. You have some dashboard/querying layer that lets you go through the events and extract specific metrics + insights

    My advice is to zoom out and compile all of the data asks from your PMs across the past 3 months. Look for patterns among them, so you can come up with a logging schema that satisfies all their queries.

    The good news is that there's a billion platforms nowadays that make this process easier and abstract most of the work away from you. Here's a bunch:

    This is a very good workstream to go from mid-level to senior. I recommend exploring these platforms (feel free to find others as well) across 1-2 hours and then putting together a proposal on the pros/cons of each one and your recommendation. You should let your manager and tech lead know about this idea as well - Maybe they can help you.