I'm working on an application, certainly not my first. Some aspects of my coding background are quite informal, for example I have only a rudimentary understanding of source code repositories.

Take library formation, for example? I'm reasonably proud that my source is of sufficient quality and organization to pass an audit - no spaghetti code here. But I'm relatively unprincipled when it comes to breaking source out into smaller files.

How are you as coders able to discipline yourself to do this? What criterion do you use to split things out? What goes and what stays?

As to splitting functions each to a file, never adopted that because I am the author and it was my choice. Now this was all C code, not C++ so with each language we followed the rules that worked for us.

In other words, standards are great since we have so many to choose from. For instance, indentation was one I told them to take a hike on. That rule would change with every manager. It wasn't worth it to change the code base to meet the new standards. If they wanted it changed, we'd ask for additional hours (money) which shut down the request quickly.

commented: thanks, I appreciate it! +0

I code in PHP with MVC architecture. Each model and controller are their own class and there is one per file. Views are PHP templates, also one template (which typically represents either a full HTML page, or a large, reusable segment of an HTML page) per file.

commented: This. Follow what works best for each language and of course your preferences. +17
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.