coding-horror / basic-computer-games

An updated version of the classic "Basic Computer Games" book, with well-written examples in a variety of common MEMORY SAFE, SCRIPTING programming languages. See https://coding-horror.github.io/basic-computer-games/
The Unlicense
10.84k stars 1.33k forks source link

Code decomposition question #882

Open DiskJunky opened 1 year ago

DiskJunky commented 1 year ago

I've been looking through some of the csharp versions and some lump all the code into a single Program.cs file. While this works, and indeed, is how the originals are organized, it doesn't quite fit the "modern practices" principle for the language.

I'm a little conflicted as to which is the 'best' approach for this project. Would anyone object to having separate files for each class, etc.?

coding-horror commented 1 year ago

The idea is that most of these were simple single file programs to start with, so breaking them apart, unless it's only 2 files instead of 1, seems to run counter to the original philosphy behind the books.

pgruderman commented 1 year ago

I really disagree strongly with this point. The programs in the book were written the way they were due to the constraints of the time, not some overriding philosophy. And in many cases, they were written by amateurs and weren't even quality examples of BASIC programs.

There are so very many resources on the internet to learn the basics of programming. I just can't imagine someone coming here to learn how to write for loops and function calls. If we aren't teaching something useful--something people can actually take away and use in their own projects or at their jobs--then what's the point?

coding-horror commented 1 year ago

You can, just keep it as minimal as possible. E.g. don't create a super complex Enterprise Edition implementation that's overengineered. Whatever feels appropriate to the size and scope of these tiny programs.. keep it simple, but certainly, keep it clean too!

DiskJunky commented 1 year ago

That was kind of what I was driving at. Standard practices of the language without decomposing the code to within an inch of its life. There's a sweet spot to be aimed for, say 3-4 classes/files, not 20-30.

As a side note, I tip my hat to @pgruderman who didn't split his infinitive in his opening sentence :)