70

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. When I write code that resides in one file I'm presenting what you need to understand to follow how this part of the system works. Every detail not in this file ...


27

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 only on files related to the change various parts of the program can be programmed by different people code from some files can be put into libraries for ...


21

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 than the file size limitations of common file systems. That sort of size also wreaks havoc with editors and compilers and linters since the syntax tree for that ...


11

I have been told to write large applications in several different files. They say it will run faster. What makes it run faster? Also does a multifile application ACTUALLY run faster than a singlefile one In C, there is no reason to assume that a multi-source-file application will run faster, and several reasons why it might be slightly slower. Use of ...


4

If you work out how to measure whether someone is a good programmer or not then you have solved an age old problem and will be hailed as a genius by project managers the world over. Instead measure whether people are enjoying the dojos. I suggest beer and pizza rather than in depth critiques of naming conventions.


3

Generally speaking, the use of conditional compilation increases complexity which makes it harder to achieve security and other desirable qualities. A part of this complexity is essential if you want to be able to introduce a certain amount of variability. The other part is accidental ans relates to the technical details of conditional compilation and ...


3

As part social scientist by training, I'm partial to the questionnaire idea. If your organization is large enough and management is willing to support your efforts, it may be possible to do a double blind experiment to see if a particular dojo helped the participants in that particular subject matter (As Ewan mentioned, we currently lack an objective method ...


3

Assuming you're talking about story point estimation, it would be preferable to simply over-point the stories if there are a large number of unknowns. It's impossible for you to fully understand a code base in just a few days. Some of these features might require heavy refactoring and that might not even be obvious until you've started working the ticket. I ...


2

Coding dojos should have "lightweight learning" for who is learning there. I believe PR in this context are not recommended once the intention of the dojo is not get fix or improve code. I had good experiences in rotative dojos once there was a laptop and the participants were intercalating between them, we used timer to give each participant 6 minutes to ...


2

Advantages of using multiple files for a program are numerous.For instance: if you write code for a class in a separate file, you can use that class in multiple programs. It increases reusability of the code. Furthermore, if you want to change anything in a class, you will only have to change it in that particularly file and the change will be ...


2

I strongly disagree with the selected answer. Your question is equivalent to asking what kind of surgery to do just by visually looking at the belly. By providing an answer in such conditions you are saying that by visually looking at the belly you know what's the illness and what surgery to do. It doesn't work that way. The previous answer just suggests ...


2

What's the matter ? I understand that this is extremely annoying. But this can happen when the rules of the game are not clearly explained. Depending on contractual matters, the customer may or may not be allowed to intervene on the code. Even if the customer may not interfere, your boss may accept it for commercial reasons (e.g. your company is very ...


2

In short Option 2 is better and there are objective reason for this. And yes, the approach can be improved. More details: why option 2 is to be preferred Option 1 lacks separation of concerns. What does this mean? Imagine that one day your project could afford to hire a team, with an expert of serialization, another specialist for iteration, and a guru of ...


2

Another significant reason to use multiple files that somehow no one has mentioned: When you work on a software development project with a team, it is very common to use a version control system such as Git. One major hurdle faced by any VCS is merging the work of multiple authors. If you and another developer work on the same file at the same time, your ...


2

That workflow seems a good match to your company's process, although people might take issue with parts of the process itself. One thing you might do to improve your workflow is to also merge develop into your new feature branch. That way you start locally integrating with other changes on develop sooner. Also, if QA is testing for a day on every pull ...


2

Generally speaking, it decreases the security risk. Whenever you have unused features, there is a chance that some attacker might find a way to activate them and this will cause code which you haven't tested to run. However, if the code is not written robustly in the first place, it may introduce new security vulnerabilities. It is reasonable to assume ...


2

What are the tradeoffs to building a unique binary? Surely there are the obvious space savings on disk, memory and cpu caches; and the performance benefits brought by space-time tradeoffs. But at least initially it seems that would increase the possibilities to test and design against. Assuming you're only talking about embedded systems, targeted for ...


1

It's not how you measure success, but when that's important. Measurements made too early lead to premature judgment and false results. To know if something is working or not you must operate in larger time intervals or coordinate your measurements with others. IOI (International Olympiad in Informatics) are organized every year. Just by looking at table (...


1

The answer here is fairly simple: don't get yourself into this situation in the first place. I don't care that it's an "independent module", you should still have split it up into chunks which were individually reviewable in the first place. Obviously I don't know what domain this is, but you're still going to have something like data access bits, business ...


1

Your assumption that the sum of CCs is the aggregate CC is correct, but perhaps not very useful. Cyclomatic complexity is based on the control flow graph. Usually, we only look at the control flow graph of a single function. We can also look at the control flow graph of an entire program, as if all functions had been inlined into the main(). Looking at the ...


1

Since my initial post of this answer didn't accomplish what I wanted, I purchased the for-Kindle version of this book, and found exactly what I vaguely remembered, in order to directly answer the question Why do we need so many classes in design patterns? Short and sweet -- we don't. Exactly why that is true I'm not sure that I can put into words as ...


1

In my experience, if the database is only connected via a single application such as a micro service api or monolithic app with one db, it does make sense to have code and db changes lock-step to avoid incomplete deployments. If you have a database in which there is no single "owner" application, separation and manual synchronization makes sense to ensure ...


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