Skip to main content

Questions tagged [code-organization]

Filter by
Sorted by
Tagged with
0 votes
2 answers
218 views

I have a project where there is a primary, high-level, opaque struct with many functions that operate on it. Maybe I am simulating a CPU. How might the corresponding source code be organized? One way ...
Ana Nimbus's user avatar
2 votes
2 answers
341 views

Question I'm working on a C#/.NET Core project, and I'm looking for guidance on organizing interfaces, especially when it comes to using NSubstitute, Moq or other libraries for mocking, because there ...
rklec's user avatar
  • 131
3 votes
3 answers
2k views

I have many abstract classes that describe many abstract ideas and objects. These classes have many complex relationships with each other, and I realize that while writing code with some of the ...
nreh's user avatar
  • 161
0 votes
2 answers
187 views

Given the following hierarchy of objects: a keyed collection of ClassA objects, where each ClassA object contains a keyed collection of ClassB objects and each ClassB object contains a keyed ...
PieterV's user avatar
  • 233
-3 votes
1 answer
138 views

We're currently developing a product which will have a Web version and a Mobile version. At the moment, the plan is to have identical features on both of these. From a tech perspective, there is an ...
pvukovic's user avatar
  • 145
0 votes
2 answers
143 views

I like the concept of Extreme Programming (as I understand it), that there should be many smaller functions with descriptive names, instead of fewer, longer ones, even if those functions are only ...
Minix's user avatar
  • 149
1 vote
3 answers
6k views

I'm trying to get a good understanding as to whether there is a best practice or standard regarding keeping values within your code libraries or referencing them from another config file. I don't ...
Kyle's user avatar
  • 13
3 votes
1 answer
476 views

As I understand, when following the Low Coupling High Cohesion Principle, I should keep together the code that is related to same theme, splitting the code into modules/submodules by its "domain&...
whyer's user avatar
  • 139
3 votes
3 answers
616 views

When exploring a new codebase, what would be some methods of storing personal notes or annotations alongside the code? If I were the only maintainer, I might consider added an actual code comment into ...
dotancohen's user avatar
  • 1,071
0 votes
1 answer
742 views

I have a Python project that looks something like this. project/ tests/ __init__.py tests.py main_module/ __init__.py sub_modules/ ... task1.py ...
RJTK's user avatar
  • 117
1 vote
2 answers
1k views

I know that lots of people hate #regions in C#. IMO there is at least one legitimate use of them: Sometimes I have a class which, in addition to its core functionality, needs to implement a commonly ...
Claus Appel's user avatar
0 votes
0 answers
80 views

I'm trying to change my module's outline since I feel I'm blocking some reuse possibilities, but I don't know how to justify it under the lens of good practices/design principles. Keep in mind this is ...
Fernando Silva's user avatar
-4 votes
1 answer
1k views

I've checked quite a few related questions on source tree organization, but couldn't find the answer for my exact need: How should I organize my source tree? What's the best structure for a ...
kakyo's user avatar
  • 95
-3 votes
2 answers
334 views

Using github as an example, www.github.com is the website people visit and api.github.com is the REST api server programs will visit. But they probably share some codebase and in my case they share a ...
Qiulang 邱朗's user avatar
0 votes
2 answers
226 views

I have a block of code that branches into 2 pathways, let's call them the "simple" and "complex" branch, based on user input. Either the simple or complex logic has 4 steps, let's call them A, B, C ...
Dragonsheep's user avatar
-3 votes
1 answer
245 views

I have a bunch of small utility PHP functions that I made to solve different scripting problems. Functions like UUID() and trackUserActivity() etc. There are tons of these functions and increasing ...
Abdul Jabbar's user avatar
0 votes
0 answers
659 views

I've willingly inherited a VB.Net forms project based on .Net 3.5 last edited with VS2012. I was able to open it up and up-convert it to VS2017. I can compile and run it and make some little tweaks. ...
GisMofx's user avatar
  • 379
2 votes
1 answer
174 views

I’m developing a Matlab GUI for a scientific computing application and need to plot fairly heavy intermediate results. Currently, the computation is represented as a function. The GUI accepts user ...
Dragonsheep's user avatar
4 votes
2 answers
2k views

The first language that I truly learned was Java. In it, it is very syntactically easy to nest classes in an essentially arbitrarily complex package hierarchy, which keeps the code organized. It is ...
john01dav's user avatar
  • 889
4 votes
1 answer
2k views

As part of a game engine I am writing in cython, one of the challenges I am facing is creating a consistent interface for error handling that works at the C and python levels of my code. I am ...
CodeSurgeon's user avatar
5 votes
1 answer
24k views

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? ...
Mat.R's user avatar
  • 77
1 vote
1 answer
2k views

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 ...
Vermillion's user avatar
0 votes
3 answers
758 views

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 ...
aybe's user avatar
  • 955
0 votes
1 answer
724 views

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 ...
Mael's user avatar
  • 2,395
0 votes
1 answer
142 views

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 ...
Vince V.'s user avatar
  • 163
38 votes
4 answers
62k views

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 similar ...
Peter M's user avatar
  • 2,145
-3 votes
3 answers
561 views

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 ...
CodeYogi's user avatar
  • 2,186
-2 votes
1 answer
140 views

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 ...
celsomtrindade's user avatar
3 votes
2 answers
839 views

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 ...
jinglesthula's user avatar
5 votes
3 answers
1k views

Suppose you have this: namespace Project.Services { public class ClientService { public IEnumerable<Clients> Query(Project.Models.Builders.ClientQueryBuilder builder) { ...
Einer Santana's user avatar
4 votes
2 answers
7k views

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 ...
alepuzio's user avatar
  • 341
14 votes
5 answers
774 views

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 Have ...
mcfroob's user avatar
  • 249
2 votes
1 answer
116 views

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 ...
Sergi Juanola's user avatar
1 vote
0 answers
50 views

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(...
Eugene's user avatar
  • 11
11 votes
4 answers
11k views

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 ...
SaxSalute's user avatar
  • 119
0 votes
2 answers
97 views

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/...
Dennis's user avatar
  • 8,307
0 votes
1 answer
439 views

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 ...
Nikita U.'s user avatar
  • 173
1 vote
1 answer
582 views

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 ...
Kashyap's user avatar
  • 169
2 votes
2 answers
1k views

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 ...
Andy's user avatar
  • 687
5 votes
1 answer
212 views

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 ...
emschorsch's user avatar
4 votes
0 answers
2k views

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(...
Anon's user avatar
  • 3,649
16 votes
1 answer
22k views

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 ...
Barth's user avatar
  • 471
3 votes
1 answer
119 views

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 ...
Olof's user avatar
  • 133
0 votes
2 answers
788 views

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 ...
hasanghaforian's user avatar
3 votes
1 answer
4k views

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 = ...
Jackmc1047's user avatar
2 votes
1 answer
205 views

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 ...
simoneL's user avatar
  • 232
3 votes
1 answer
269 views

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 ...
Pithikos's user avatar
  • 232
1 vote
1 answer
1k views

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 ...
Denis Pshenov's user avatar
4 votes
0 answers
2k views

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 ...
Vasu's user avatar
  • 141
0 votes
1 answer
100 views

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, ...
dcgoss's user avatar
  • 181