351 votes
Accepted

Why do we need so many classes in design patterns?

This is an optimization problem A good engineer understands that an optimization problem is meaningless without a target. You can't just optimize, you have to optimize for something. For example, ...
John Wu's user avatar
  • 26.4k
225 votes
Accepted

Should I refactor the code that is marked as "don't change"?

It seems you are refactoring "just in case", without knowing exactly which parts of the codebase in detail will be changed when the new feature development will take place. Otherwise, you would know ...
Doc Brown's user avatar
  • 206k
148 votes
Accepted

Why are some C programs written in one huge source file?

Using multiple files always requires additional administrative overhead. One has to setup a build script and/or makefile with separated compiling and linking stages, make sure the dependencies between ...
Doc Brown's user avatar
  • 206k
140 votes

Should I refactor the code that is marked as "don't change"?

Yes, you should refactor the code before you add the other features. The trouble with comments like these is that they depend on particular circumstances of the environment in which the code base is ...
Kilian Foth's user avatar
82 votes

Why are some C programs written in one huge source file?

Because C isn't good at modularization. It gets messy (header files and #includes, extern functions, link-time errors, etc) and the more modules you bring in, the trickier it gets. More modern ...
Mason Wheeler's user avatar
71 votes

What are the benefits of multi-file programming?

There are a lot of technical reasons behind using multiple files when writing large complex systems. All of them are meaningless in the face of the best reason to use multiple files: Readability. ...
candied_orange's user avatar
70 votes

Why do we need so many classes in design patterns?

Well, first of all, readability and maintability are often in the eye of the beholder. What is readable to you may not be to your neighbour. Maintainability often boils down to discoverability (how ...
MetaFight's user avatar
  • 11.6k
60 votes

Should I refactor the code that is marked as "don't change"?

My question is: should I refactor the code when I encounter such warnings from the authors No, or at least not yet. You imply that the level of automated testing is very low. You need tests before ...
Daenyth's user avatar
  • 8,117
52 votes

Why did BASIC use line numbers?

On early microcomputers editing was line based. You couldn't just move freely around in the source code and edit. You had a single line at the bottom of the screen where you could type commands and ...
JacquesB's user avatar
  • 58.7k
46 votes

Why did BASIC use line numbers?

If you are thinking of BASIC dialects of the 8-bit home microcomputers of 80's, then those computers did not have text editors (unless you bought some word processor application). There was no way to ...
hyde's user avatar
  • 3,744
31 votes

Why do we need so many classes in design patterns?

Please explain me, why do we need this DDD style, lots of Patterns? First, a note: the important part of DDD is not the patterns, but the alignment of the development effort with the business. Greg ...
VoiceOfUnreason's user avatar
29 votes

Why do we need so many classes in design patterns?

There are many good points in the other answers, but I think they miss or don't emphasize an important conceptual mistake you make: You are comparing the effort to understand the complete program. ...
Jens Schauder's user avatar
28 votes

What are the benefits of multi-file programming?

The question falls into same category as why buildings are not build from one piece of rock but a bunch of bricks? Answer: easier to navigate than scroll through one huge file make recompile works ...
Polar Bear's user avatar
23 votes

Should I refactor the code that is marked as "don't change"?

Remember the G. K. Chesterton's fence: do not take down a fence obstructing a road until you understand why it was built. You can find the author(s) of the code and the comments in question, and ...
9000's user avatar
  • 24.2k
22 votes
Accepted

How to deal with large source codes?

For example, a simple "if" can occupy a whole screen (more or less 30 to 40 lines). I do not need to mess with it anymore, but it's not a function, it's not a class, just a part of the code that has ...
candied_orange's user avatar
21 votes

What are the benefits of multi-file programming?

The other answers are fine, but something they're missing is actual technical limitations. For example, you can't actually save all of the code for my day-job application in one file - it's bigger ...
Telastyn's user avatar
  • 109k
19 votes

Why do we need so many classes in design patterns?

Because testing code is harder than writing code A lot of answers have given good reasoning from a developer's perspective - that maintenance can be reduced, at the cost of making the code more ...
Bilkokuya's user avatar
  • 337
18 votes
Accepted

Apollo-11: Using inclusion instead of a linker

They seem to mean simple textual concatenation / insertion. In other words, even though the source text was split into individual files, the program wasn't split into modules.
Jörg W Mittag's user avatar
18 votes

Why did BASIC use line numbers?

In the place and era when Basic was developed, the best available I/O device was a teletype. Editing a program was done by printing (on paper) a listing of the whole program, or the interesting part ...
ddyer's user avatar
  • 4,070
18 votes

Why do we need so many classes in design patterns?

Please explain me, why do we need this DDD style, lots of Patterns? Many (most...) of us really don't need them. Theoreticians and very advanced, experienced programmers write books about theories ...
Vector's user avatar
  • 3,180
16 votes

Terminology - is source code a program?

See the Wikipedia entry for Program: (I've added the bold) A computer program is a collection of instructions that performs a specific task when executed by a computer. A computer requires programs ...
Dan Pichelman's user avatar
16 votes

Why are some C programs written in one huge source file?

In addition to the simplicity factor the other respondent mentioned, many C programs are written by one individual. When you have a team of individuals, it becomes desirable to split the application ...
Ron Ruble's user avatar
  • 294
15 votes
Accepted

Distributing GPL-ed software with lost source code

No, the GPL only allows to distribute software when the sourcecode is available. When Jerry releases it without source, he is violating Tom's copyright. However, when it is really that important, ...
Philipp's user avatar
  • 23.3k
15 votes
Accepted

Where to archive code

If it's for a program which is already under source control, just keep these changes in a branch of that repo. For odd bits of code, you could use almost anything, but some good options would be ...
Dan1701's user avatar
  • 3,118
15 votes

Did Dijkstra intend for code modularization, when he wrote about separation of concerns?

Separation of concerns is an abstract way of thinking that consist in considering separately things that do not have to be related. Modularisation (separating unrelated group of functions into ...
Christophe's user avatar
  • 76.8k
13 votes

Why did BASIC use line numbers?

"Line numbers" means a few different things. First of all, keep in mind that the concept of "lines" hasn't been around forever. Many programming languages in this era used punched cards, and having ...
Mike Harris's user avatar
12 votes
Accepted

What is the difference between predicate and branch

A predicate returns a yes/no answer to a question - that is, a boolean conditional. A branch is what you do depending on the answer (assuming you do different things). So, in c type pseudo code: if(...
Oded's user avatar
  • 53.5k
11 votes
Accepted

What is the difference between Code Smells and Anti Patterns?

A Code Smell is something which should be investigated. Is it a piece of delicious cheese or is it rotten beef? An Anti-Pattern is just bad, a Code Smell is something which may or may not be bad. ...
Jörg W Mittag's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible