How do programmers do it?

I've been reading that Linux has around 17 million lines of source code, Microsoft has around 50 million and games like minecraft have in the billions. Do programmers actually have to sit down and write each line individually? Or is there a software that does it for them? How do some programmers make websites/games/apps in one week? How is that possible?

If it's a really big program, like 50 million lines? They could use *two* programmers…

anything more than the simplest kind of program is usually constructed out of subsections, whether they're called procedures or functions or objects or whatever, that can all pretty much be written independently of each other. All that has to be specified is the technically allowed inputs and outputs of each

that is, the first guy writes this part, the other guy writes that part. Neither one has to known anything whatsoever about how the other part works, he just has to know what the other part requires as input, and what the other part spits out as output

just like you don't have to know how a tv works, to watch the brady bunch

Its a big red button, you push it and it does all the work for you.

In programming they use a multitude of programmers who a set specific tasks, like movement, interactions, physics. One thing you learn with programming is that a lot of the code is used repetitively. So there's quite a lot of copy and pasting and editing. For example if they make a dirt block in minecraft they type all the code, but to then make a stone block, all they do is copy the code from the dirt one, then edit the values. Most of coding is copied from previously

I don't think the number for Minecraft is quite that high, but the numbers for Linux and Microsoft Windows are probably right. As for those two operating system, they have been worked on by 100's if not thousands of programmers over the course decades, but yes someone did write everyone of those lines. These are very complex pieces of software, simpler apps don't have anywhere near that number of lines, so they can easily be written in a week. It's also rare for a programmer to write everthing from scratch for each app, they generally re-use stuff they have already written for other applications, or things developed by other programmers.

Development is done in teams. No, there's no individual programmer writing all the code, it's multiple teams building various sections. For something like Windows it's over 1000 people.

"We organize the work of Windows into "feature teams," groups of developers who own a combination of architectural elements and scenarios across Windows. We have about 35 feature teams in the Windows 8 organization. Each feature team has anywhere from 25-40 developers, plus test and program management, all working together."

I sit down and write a model class in PHP, I want it lean and mean, when I'm done though, there are already more than a hundred lines, even though of most of it are short accessor methods, the more fields in the database table, the more accessor methods.

Its not like a novel where lines are full page widths. But 50 million is 50 million, that is a lot of code for a lot of functionality though, Microsoft hires thousands thousands of programmers though and its not written in one sitting, I think there are a lot of code in Windows that are from prior versions.

I read that back in the old days, 70s or early 80s, IBM hired Microsoft to write OS/2, they paid by lines of code written, so Microsoft made OS/2 really, really, rally bloated.