Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code decomposition question #882

Open
DiskJunky opened this issue Aug 8, 2023 · 4 comments
Open

Code decomposition question #882

DiskJunky opened this issue Aug 8, 2023 · 4 comments

Comments

@DiskJunky
Copy link

DiskJunky commented Aug 8, 2023

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
Copy link
Owner

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
Copy link
Contributor

pgruderman commented Aug 26, 2023

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
Copy link
Owner

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
Copy link
Author

DiskJunky commented Aug 26, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants