DEV Community

Axel Martínez
Axel Martínez

Posted on

How large is your codebase?

The questions

So, today something sparked my curiosity to know just how large is the codebase I work with at my job ??

And along with that: Is there a way I can measure that?

One approach

In retrospect, I've grown with the company... working with teams as they are created to create new parts of the platform and new applications which some are exposed to external users and others remain for internal use only.

I looked for the repos I have worked on so far and found that it was at least 10 different UI repos from our microservice architecture, and that out of those maybe 5 or 6 I pushed code for their groundwork, including the component library we have in there and a starter that we use to spin up new repos.

Nice! Axel 1 - 0 Imposter syndrome

What about being more specific?

Then I thought: "All right, but they could be real small repos with apps which are not that complex or business logic that is too simple". Spoiler alert: nope, some have really heavy logic stuff that I am actually very proud of, like the migration I worked on last year.

Pretty sure somebody already said that our worst enemy lies within ourselves. 2 points for me 🎉!

So, how large would the codebase I am working with really be?

Still hard to answer that using cold numbers, but!

I figured if there was a way I could count the Lines Of Code for some of those repos, I would probably feel like I have a better idea and can finally go to bed 😛.

Stack Overflow to the rescue... and I found this answer to determine an approximate of how many lines of code I had.

So, fired up my terminal and on the repos I remembered I worked on I ran:

$ wc -l $(git ls-files | grep 'source/')
Enter fullscreen mode Exit fullscreen mode

Please note that this is specifically grepping (is that a verb?) for the source folder, meaning there are no files in the dependencies listed (npm packages or bower stuff or whatever).

So we have in no particular order (commas added for readability) the following results for a few repos:

31,461 total
17,371 total
29,263 total
168 total
2,827 total
11,178 total
1,501,180 total
Enter fullscreen mode Exit fullscreen mode

Go to sleep already!

Just one more thing...
How would my contribution to those repos look like? Because sure, those could be (or not) large numbers, but how much have I really contributed to that so far? (There is also some good in questioning one self, I'm sure, to keep you real).

I went and checked the contributions per user on said repos and found (not in the same order I listed the previous, so no direct correlation there):

ackzell
120 commits  30,648 ++  6,652 --

ackzell
162 commits  16,106 ++  9,009 --

ackzell
13 commits  617 ++  173 --

ackzell
125 commits  20,977 ++  9,926 --

ackzell
23 commits  51,816 ++  48,318 --

ackzell
2 commits  206 ++  197 --

ackzell
16 commits  959 ++  750 --
Enter fullscreen mode Exit fullscreen mode

Seems like I've written (and removed) a good chunk of that platform, and I am so very proud of my work.

So next time I am prompted to answer myself "how large is the codebase you are working with?" I will at least have a vague idea 😬)

Cheers!

Top comments (2)

Collapse
 
davidromero profile image
David Romero

That's a lot of code. How many people are working on each project?

The biggest one for me was a 15 year c++/proprietary stuff then I discovered a lot of unused or no longer supported code, plus non existent documentation :). I was fun for a while but It had to much code debt.

I'm wondering how do you deal with that, rapid changes, many people working on the same stuff, code coverage, etc. Saludos

Collapse
 
ackzell profile image
Axel Martínez

Thanks for the read!

There is no fixed amount of people and since not all of the services require constant maintenance some will be left alone after the first couple months when development has finished. Others have been taken over by my former teams after I was assigned to a different one and they vary in size. But there is between 1 to 3 UI devs working on the bigger and more active repos.

There are QA Engineers and Release Engineers, as well as dedicated teams for UX and BackEnd engineers for each product, as well as Product Owners and Scrum Masters assigned to the teams. There is a lot of coordination effort going on all the time, and it definitely helps that one doesn't have to wear a ton of hats at the same time 😝

Although every now and then you get to create a Test Case and do a Test Run, or provide the solution when UX doesn't give you direction... or change a small thing in the Java code for the endpoints, it is not that common.

Saludos!