How do we work on someone else code, like to implement a new feature
Hello, quick question, I'm currently doing an internship. Last year also I did an internship where I needed to build something, it was pretty interesting. But this year, what happens is that I was put directly in a team to work on leftover works in their backlog (very boring tasks). Even though it was boring, what I noticed is that the codes have been written by many devs and it rarely happen that we work on something from scratch.
So my question is, say I need to understand the code of what developers did, how do I do that? I mean for example, I started to debug things, I understood what's happening on a high level but there are still things that I feel without knowing what was done initially, from scratch, it's a bit to add/implement something.
So I wanted some ideas on how you guys do when you need to implement some codes in a software that wasn't written by yourself, it's kind of annoying, right? But I do realise that this is what's going to happen when I will work on full time job, just wanted some advice on how to tackle/exit out of this scenarios.
10 Replies
i inherited a project with over 1800 php files, and most files have 3 classes thst inherit from classes thst inherit from others
but i would start by trying to make a glossary of what means what
then try to find patterns in the code, while working on it
and if it has debug features, make use of them
oh ok, so you take side notes?
You usually don't need to understand the entire code base. You only need to understand the part related to what you are doing. If the code is well written, there should be some implementation of the principle of "separtion of concerns" and "single responsibility". In that case, you would look for code related to what you are going to work on and only examine that part of the code base.
If the code is poorly written, there are no tricks to help and even a highly experienced professional will struggle to deal with it.
yep I see, thanks !
yup, on a badly distributed code base, that is how it will be
you will have to find out what does what
again, if there are debugging features or any extra information you can get, take it
if it is a website, a simple trick is to find the code by classes or ids in the html
or anything you can easily identify
like a comment, a tag, a bit of js, a name ... anything
If the code is well written…Tell me you've never worked on real code before without telling me you've never workd on real code before 🤣
I used "if".
(also, lo-key: yeah, working on other people's code is just suffering, especially at the start. It gets better the more familiar you get with someone else's code and style)
With bigger/midsize opensource projects they usually have guidelines you should read.
same at companies, but the documents will usually be at least 4 years out of date and not very good to begin with because they were written by the one guy who went to a convention that had a talk about this stuff and made it his slacking-off-project he could dump hours into on his timesheet and then had to rush to finish when his manager wondered why he had 140 hours of work on something he'd never seen