Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-organization]

The tag has no usage guidance.

-1
votes
1answer
821 views

Folder structure for a C project [closed]

I am wondering what is the recommended folder structure for a C project. I read several posts about using src, include, test, build folders. But what if I want to structure the project in modules? ...
0
votes
1answer
516 views

Organizing Python functions into a module or class

I'm working on a module for clustering algorithms, clustering.py. I noticed several functions in the module only pertain to the mean shift algorithm, so I thought it might make sense to group them ...
0
votes
4answers
327 views

When it isn't right to add types to a well known namespace?

For the purpose of writing a library, I found to be nice to add types to some well known namespace. Example: I've written a couple of extension methods for BinaryWriter and naturally put them in ...
0
votes
1answer
211 views

Relative merits of monolithic repository over multiple smaller ones

I was tasked with implementing a networking stack. The software is self-contained with no external dependencies - it only needs the C++14 standard library, and a POSIX platform. In my opinion there's ...
0
votes
1answer
60 views

Thinking about a setup to work with react and front end development

On my team I'm working as a frontend developer in a React codebase. We're building an application and do everything in React. Before this I was actually always a backend developer. Now I have the ...
5
votes
3answers
13k views

How to best to organize class and interface files?

OK .. after all the discussion I'm changing my question slightly to better reflect a concrete example that I am dealing with. I have two classes ModelOne and ModelTwo, These classes perform ...
-3
votes
3answers
395 views

Writing quality code [closed]

I know there are many books on writing clean, modular, readable and whatever else you can say but frankly speaking I find it very hard to remember every advice given on those books. Frankly speaking ...
-2
votes
1answer
95 views

Using git on a project with different areas

I'm starting a new project and I'd like to plan it's use with git (using SourceTree) before starting. I work as a self developer and I'm starting a project that will have 3 different areas. This is ...
3
votes
2answers
452 views

Mixing JavaScript and server-side scripting

I see code like this sometimes (mixed PHP and JS in this case, but could be any server-side language): <script> var data = <?php echo $bigDataStructure ?>; // then lots more pure js ...
5
votes
3answers
524 views

Should parameters of a method be in the same namespace as the class?

Suppose you have this: namespace Project.Services { public class ClientService { public IEnumerable<Clients> Query(Project.Models.Builders.ClientQueryBuilder builder) { ...
1
vote
2answers
1k views

How I can organise a project in more programming languages in Git repos? [closed]

At work I'm using Java, but I'm planning to study some other programming languages as Python or Clojure. I'm thinking of coding one project in Java in my Git repository and, during my study, coding ...
15
votes
5answers
564 views

Small functions vs. keeping dependent functionality in same function

I have a class that sets up an array of nodes and connects them to each other in a graph-like structure. Is it best to: Keep the functionality to initialize and connect the nodes in one function ...
2
votes
1answer
85 views

Encapsulate multiple retrieval methods for a class

I'm doing a little bit of cleanup and I'm trying to gather all the spread SQL queries done to an object into a single place. I have a class whose responsibility is to present a CRUD interface to the ...
1
vote
0answers
24 views

How to handle the set of objects that represents a context?

How can I handle the situation when exists the context that represents a collection of arbitrary objects? This context can be created by code like this: $context = new Context(); $context->add(...
6
votes
4answers
3k views

How can I effectively use one file per class in C++?

Even though I have a decent bit of professional experience with object oriented programming in Java and a basic familiarity with C, I've run into a bit of a mental block with C++ that I was hoping ...
0
votes
2answers
71 views

Is an approach to store classes that belong to a single feature in a single folder, superior to classifying them in several “community” folders?

in my project I am finding that I mix and match the following two patterns, when it comes to organizing classes in folders/namespaces: Modularized MVC Blocks module/Album/Feature/Controller/...
0
votes
1answer
142 views

Is it a bad practice to use external files for storing SQL templates?

I am working on a report system which aggregate a lot of data from multiple sources (databases and internal APIs). Among other things I communicated with another departaments and told them I need some ...
1
vote
1answer
272 views

Ruby: Abusing mixin

I'm currently working with some code that IMO has abused ruby's mixin features. Given that I'm new to ruby, I wonder if MO in IMO is correct or not. My primary question is what makes more sense (and ...
1
vote
2answers
735 views

How to structure classes in a large codebase

One of the most touted rules of OOP is to keep classes small. This means that in a significantly sized project there are bound to be thousands of classes. Logically it seems to make sense to combine ...
5
votes
1answer
156 views

How to organize my module

This is currently the way I'm organizing it. myProject/ README subproject1/ __init__.py classA.py classB.py driver.py basicTest.py Driver imports from ...
3
votes
0answers
136 views

Should the order of definitions correspond to the order of declarations in header/source files? [closed]

If my header looks like this: class foo { public: foo(); ~foo(); QString b(); QString c(); QString a(); void setB(QString s); void setC(QString s); void setA(...
12
votes
1answer
13k views

Directory organization of a CMake (C++) repository containing several projects

I would like some advises on the organization of a set of related but independent C++ projects stored in a single (git) repository. The projects use CMake. For a simplified example we imagine 2 ...
3
votes
1answer
97 views

Split program to smaller programs

I have for planned to build my own drone from scratch for learning purpose and will program all controls for the drone. My question is if it's a good idea to split the code that doesn't interact with ...
0
votes
2answers
572 views

Way to organize repetitive text in Java

Some times I have texts that appears in different places, like comments, messages... For example if I have a custom Exception, probably class doc, messages that passes as parameter to its constructor ...
2
votes
1answer
2k views

What is the purpose of separating routes into individual modules with Node.js and Express?

My app uses Node.js and Express 4 and has the following code in the app.js file located in the root directory: var express = require('express'); var index = require('./routes/index'); var users = ...
2
votes
1answer
114 views

Pick dynamically the right Factory Class with Inversion of Control

I have a TreeView and I want to enable the context menu when clicking with the right mouse button. It is composed by items from different classes, but they all share the same base class. So, I was ...
3
votes
1answer
214 views

Structure project based on platform or design?

I have a medium sized project (~10,000 lines) that runs on Windows and Linux. However it is only specific components of the program that are platform dependent and are located in a folder called ...
1
vote
1answer
593 views

How to organize large polyglot projects?

One of my projects started as PHP but recently some of the new functionality has been written in JavaScript on Node.js platform. How do big polyglot projects that use multiple languages to write ...
3
votes
0answers
780 views

Structuring a multi-language project?

I'm working on a project which involves writing code for multiple devices, each in its own language (in particular, Arduino and Python). I want to contain the entire project in a single directory, but ...
0
votes
1answer
77 views

Know any good resources/information on architecting an iOS app? [closed]

I spent a few months working on an iOS app of mine (in Swift) before realizing it was really a bunch of MVCs (Massive View Controllers). I want to start fresh and build something modular, scalable, ...
5
votes
1answer
909 views

What and how much domain code should be put in an F# module

According to recommendations given here, F# modules should correspond to DDD bounded contexts, i.e. subdivisions of a business domain. The bounded context I'm working on right now has 2 aggregates ...
4
votes
2answers
713 views

Practices for organizing JavaScript AMD imports

Our company has been using newer versions of the Dojo framework, which have progressed to an AMD-based loader format. I'm currently trying to find logical ways to separate layer files, taking a module ...
1
vote
0answers
304 views

Organize Web API Controllers by their associated Views, or by the logical type they operate against?

We're building a large Angular SPA that uses ASP.NET Web API on the backend. The application will have a large number of views (100-200). I'm debating whether to organize the Web API such that the ...
1
vote
1answer
2k views

Git structure for java project

I know there are multiple posts on similar problems, so please be kind with me. I am asking for suggestions I have not thought of and for good advice. I have a java "project" that is structured in a ...
2
votes
2answers
4k views

Organizing solution / project structure and classes for Line of Business Application (LOB)

The question how-do-you-organize-your-projects already has a few good answers. I would like to get a better understanding about this suggested structure: MyApp.Core MyApp.Model MyApp.Presenter MyApp....
3
votes
5answers
5k views

Breaking up classes and methods into smaller units

During code reviews a couple devs have recommended I break up my methods into smaller methods. Their justification was (1) increased readability and (2) the back trace that comes back from production ...
3
votes
3answers
1k views

What is a good way to share internal helpers?

All my projects share the same base library that I have build up over quite some time. It contains utilities and static helper classes to assist them where .NET doesn't exactly offer what I want. ...
6
votes
1answer
423 views

What to focus on when separating a monolithic codebase into separate (NuGet) packages?

I work on a fairly large web application. The main solution containing the web application project has over 100 projects. The average build time of that solution is 2 minutes on a 12 GB quad-core ...
2
votes
3answers
3k views

When to use python function nesting?

I am writing a program that creates backup of directories. Which of the following approach is better for code organization? Create separate class for Backup and Zip logic - class BackupUtil: ...
3
votes
2answers
432 views

Should accessible members of an internal class be internal too?

I'm designing a set of APIs for some applications I'm working on. I want to keep the code style consistent in all the classes I write but I've found that there are a few inconsistencies that I'm ...
1
vote
1answer
2k views

What are the tradeoffs for using 'partial view models'?

I've become aware of an itch due to some non-DRY code pertaining to view model classes in an (ASP.NET) MVC web application and I'm thinking of scratching my itch by organizing code in various 'partial ...
4
votes
0answers
132 views

How to manage success dependency between unit tests [duplicate]

How do you manage the dependency of one unit test on another unit test succeeding? So, supposed I have a class and this class has say 5 methods. I create like 2 dozen unit tests (test methods) for ...
3
votes
2answers
662 views

TDD workflow for (implementation specific) edge cases

When developing features with TDD, I create a test for each combination of feature and case. So, one test for creating user successfully, one for validation errors, and one for database errors. I don'...
4
votes
3answers
2k views

DAL vs BLL functions' return types

Here is how I see the main differences between the DAL and the BLL: The DAL directly query the database. The DAL doesn't create new information. It may execute complex sql requests, joining several ...
1
vote
1answer
75 views

When using an ORM should mappings be defined in the code file?

Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing ...
2
votes
4answers
1k views

What is the proper way to store an object with many attributes in Objective-C?

I have an object that I am downloading over HTTP, that has approximately 50 attributes. What is the proper way to store this information in Objective-C? Should I have an NSObject with a property for ...
6
votes
2answers
3k views

Where to put interface in .Net

I have VB.Net project, with a class with a couple of abstract (mustoverride) properties, that I am thinking about moving into an interface. My question, is structurally how do I do this? Currently ...
5
votes
1answer
277 views

How Do You Organize Your Methods in OO Progamming [duplicate]

Whenever I am programming in an object-oriented language, I am always faced with what order and how to group the methods for an object. Are there any standards for this, or any suggestions?
3
votes
1answer
1k views

Organizing related projects and dependencies for nuget publishing

I've been working on writing .NET bindings for Rollbar, an error and message reporting service, like Airbrake. My library is working nicely and is published in the NuGet gallery. So now I want to ...
3
votes
1answer
1k views

What are standard directory layouts for storing database scripts in TFS?

I recently took over the maintenance of 10-15 SQL Server databases and to my surprise found out that the team does not store the code scripts anywhere. They currently deploy changes to each ...