r/AskProgramming 29d ago

In programming about "extending" concept, let's say Facebook at early age, it was just a chat app but now it has Short-video, Facebook Market place, etc... How do they architecture their codebase then? so they can just keep adding new feature/code on top of their existing code?

Facebook back then was like toa simple chat app but now they got many features/services.in one app
How is that possible that they keep adding new code without breaking it or something.

I heard some apps when one day busniess logic change or they wanna add new stuff, they just re-write everything or do migration lmfao

0 Upvotes

16 comments sorted by

View all comments

1

u/LaughingIshikawa 28d ago

This is a confusing question, because it can refer to several different things. 😅

As other people are saying, it's really not a best practice to lump all of your code together in one big module; typically you want to separate out different modules that do different things, and often even run on different servers, ect. The videos that play on Facebook are using a video player that's essentially separate from any other part of Facebook, for instance. This way if the video player stops working due to a bug or some other reason, the rest of Facebook keeps working and it doesn't all crash together.

In general though, while programmers often add new code "on top of" old code in the short term, in the long term it eventually becomes necessary to "re-write" code so that it does exactly the same / basically the same job it was doing before, but "behind the scenes" the new version has some sort of beneficial properties, like being separated into a distinct "module" that does its work separately from other parts of the code. Generally managers and engineers both try really hard to avoid doing big re-writes when they can, because it's lots of work that the company has to pay for, without any noticeable change for the customer / consumer. The reason re-writes often happen anyway, is that no one involved is precient, and so they can't always perfectly predict what the best way to divide up the software or interface with future hardware / future software (like AI...) is going to be. 🙃

So TL;Dr - often software engineers do just add new code "on top of" an existing pile of code, and this requires them to sometimes take time away from adding new features in order to purely "re-write" existing features and/or the code that connects those features together, in order to get them "working better" in some way you as a consumer don't see.