How I maintain a work log as a Software developer?

Recently I have been tweeting about how a "work-log" has helped me out at my current job. It is practically a superpower at your disposal according to me, but many people are confused about how to write and use work logs and what should be the best way to go about starting with them. So if you are someone who wants to not waste multiple hours on an issue you have already worked on or want to be an excellent team member, this is the right blog for you!

What is a work log?

brown tree log

What do I mean when I say a work log? A documented approach to your work? Do I write it before coding or after coding? Where do I store it? What is the format I use for them?

A work log is nothing but a diary for your work, it can be in any format which you feel comfortable writing and consuming later on. It can be as raw as you want it to be or as detailed and well-constructed. The best introduction form of a work log is maintaining a physical notebook alongside you whenever you are working on something new or interesting and noting down anything you find 're-visitable'.

A format I follow for making a work log is keeping a document open in one of my monitors while working on everything, adding an extension that automatically adds a time-stamp to my edits and just jotting down any form of questions, errors and fixes I come across.

My work log setup:

  • I use obsidian as my go-to work log maintainer, it is hands down one of the best writing tools out there if you are looking for something lightweight and quick to use. This helps in reducing the friction of your using the application, the easier and quicker it is to use the better.

    • Notion is another great alternative if you are looking for something more frameworked.

When do I write a log?

selective focus photo of brown and blue hourglass on stones

    • Every time I encounter an error

      • Every time I encounter an error, I make a mini document for it and note down the progress I make with it

      • I attached all the references that are useful to filter out the ones which were not in the right direction and kept them in the appendix

      • Once I am done with the error, I post the document to my team's shared server for anyone to access in case they share the same fate

      • Starting a new project

        • Whenever you are starting on a new project, it might be impulsive to directly start working, but as you explore more complicated tech stacks and problems you need to start accounting for the pros and cons each approach provides to you.

        • I note down all the requirements, then branch out making documents covering how each requirement can be solved upon

        • I explore other projects targeting similar problems and add them as references and also note down any form of pitfalls.

      • Solving a DSA or Design question

        • Many times when tackling an interview question you take notes, but why do people skip this when practising or doing mock questions?

        • Writing a work log for such questions helps in creating a clarity of thoughts and displays all the information for your disposal in front of you which ultimately are like puzzle pieces for you to use and find the solution

Example:

One of my worklogs for you to refer, this is for a leetcode question I was trying a couple of months back, and the entire process of finding the solution to the reference video I captured without filtering the though process, if you are not sure how to go about writing a work log this can be a great starting point

The following work-log is for question aggressive cows for binary search.


- This is a question I always had trouble understanding even the first time around. I saw striver's playlist for it this time to understand it better
- video link: https://takeuforward.org/data-structure/aggressive-cows-detailed-solution/
- The question:
- **Problem Statement:** You are given an array **'arr'** of size **'n'** which denotes the position of stalls.  
    You are also given an integer **'k'** which denotes the number of aggressive cows.  
    You are given the task of assigning stalls to **'k'** cows such that the minimum distance between any two of them is the maximum possible.  
    Find the maximum possible minimum distance.
```
**Example 1:****Input Format:** N = 6, k = 4, arr[] = {0,3,4,7,10,9}
**Result:** 3
**Explanation:** The maximum possible minimum distance between any two cows will be 3 when 4 cows are placed at positions {0, 3, 7, 10}. Here the distances between cows are 3, 4, and 3 respectively. We cannot make the minimum distance greater than 3 in any ways.
```

- My understanding: I knew this was a binary search question from start thus it was not dificult in identification but to find out that binary can be used, the pattern here is:
    - Minding max of min
    - or min of Max 

    the soluition goes as follows,
    I have a requirement of placing all my cows so K should always suffice
    I need to make the minimum distance maximum

the first min distance will always be 1, since I can place two cows right next to one another

so the intuition is to find what can be the upper bound
it can be the right most value or the max of the stables 

so we will sort the array first, so {0,3,4,7,10,9} becomes 0,3,4,7,9,10
so now I will iteratively place the cows at minimum distance from 1 to max, what is the max distance we can place the cows?
10 since min is 0, so max becomes 10-0 = 0 so maxValue - minValue of the array is the max distance we can have between two cows

so we have to make a way to check if all my cows can be placed with minDistance varrying

psuedo code for this:
- Take the array and a minimum distance possible and number of cows
- Place the first cow at the first point, maintain a last variable to hold the value of the last placed cow location
- update last to the first slot 
- in every other slot:
    - check if current slot - last slow distance is >= minimum distance allowed
        - if allowed, place a cow, so cow count --  and update the last to this position
        - else move to next point
- when the loop completes check if cow count becomes 0, if so return true else false 

the above code can be ran iteratively for all the values of minDistance, ranging from 0-10

brute force:
    run another loop for 0 to 10, and check the max count for which the cow check code returns true

this is the part where binary search comes into picture, instead of going 1 by 1 from 1 to 10
start from middle, 5 if it can be used as the min distance in the above logic, 
    - If yes, we know that all values on left will return true also, but since we want to maximize we will go the right and find the last possible value which will return true
    - if no, we know all the values on right will fail too but we need to find the first value on left that turned false
repeat the process till you run out of index to get middle (i.e. left<=right)

the last right that you examined will be your maximum(minimum_distance)

https://leetcode.com/submissions/detail/1230521275/

Conclusion:

Hope I was able to convince you to start documenting your work in the form of logs as it will create exponential growth and save you tons of time as you go on further in your career! This is a personal way of going about it, what is important for you is to find your way of writing logs and making sure you stick to it!