How do you organize your code so that it can easily be ported across business projects without carrying unnecessary bloat?
For example (in .Net), let’s say you have the following namespaces:
namespace Computers
- Hardware
- Motherboard
- GPU
namespace Monitors
- Display
- Mirrors
namespace Peripherals
- USB
- PS/2
- Do you create a project per parent namespace and then reference that project dll in other projects?
- Do you create one big class library and port that thing around (even if you only need 5% of the library)?
- Or, do you just create one file and copy the code you need into that file; toting that file around into all the projects that you need to achieve a “plug and play” architecture (as bad as this seems)?
Edit:
I’m not looking for .Net answers specifically, but it’s the concrete example that I’m using (since an abstract example would make it harder to understand the question in this instance)
Not necessarily. It usually ends up that way because my libraries typically aren’t very big but you’ll notice Microsoft certainly doesn’t do that. System.Web exists even if you don’t include the System.Web reference. You just get more classes if you do. Indicating that the System.Web namespace is used in several different DLLs.
Yes. Hard drive space is cheap, cheaper than maintaining redundant code.
It depends on the function. I’d usually place something like this in a snippet. For example a typical function that shows up in my web projects is something like:
It’s never seemed like a good candidate for a library function because then I’d have to pass in the CSS class I wanted to use and occasionally the colspan value for the cell. But you’ll see some sort of implementation like this sitting in a few places in my web projects.