Questions tagged [code-organization]
Code organization is the way how code is placed in a project.
code-organization
628
questions
0
votes
0
answers
58
views
Is it good practice to create a separate file for calling a function that's going to be called only once? [closed]
I'm doing a data analysis project in python. I have the following files.
data_import.py (contains functions for accessing data api and saving it into file)
main.py (calls the function in data_import)
...
-2
votes
2
answers
132
views
Determining Optimal Code Complexity in Spring Boot REST Controller Methods [closed]
I'm currently working on a Spring Boot project where I have several REST endpoints defined within a controller class. While implementing these endpoints, I started wondering about the best practices ...
-2
votes
2
answers
98
views
Dividing main() function into separated functions
I just copied a very simple animation code from YouTube to learn how to do animations in raylib. But the whole code is written inside of the main() function. I want that to be organized and separated.
...
-1
votes
1
answer
88
views
Is there a way to collapse multiple functions at once but not all of them in vscode? [duplicate]
I want to group multiple lines of CSS code into a single collapsible section, is there a way to do that in vscode?
I tried to use brackets but that didnt work. I tried other things as well but ...
0
votes
1
answer
25
views
How to nest suffix file names like "texts-fr.json" to "texts.json" in Visual Studio?
I have a folder with i18n texts with files like this: texts.json and its translations: texts-en.json, texts-fr.json etc.
I am trying to use fileSuffixToExtension to nest all other files under texts....
0
votes
2
answers
59
views
Sharing private members in composition
Say I have two classes:
class Element {
parent: Manager;
get() {
this.parent.table();
}
}
class Manager {
run(){}
table(){}
}
However, say that this is a library, run() is ...
-1
votes
1
answer
71
views
C++ "use" namespace "before" declaration [duplicate]
I know that most code isn't organized this way at all, but for my specific purpose, DS&A problems, I would like my code in a single file and organized a specific way (with main on top)
int main(){
...
0
votes
0
answers
29
views
How to navigate between files in order to be able to add/remove panels from a frame?
I'm trying to make a text-based game and since I'm expecting to write a long code I decided to split it up into multiple files. (https://gist.github.com/Okkun9001/6d511dda544279a2c9d2e636b714a215)
The ...
1
vote
1
answer
116
views
How to have internal shared functions in Firebase Cloud function project?
In order to organize my project, I have decided to spread my cloud functions into multiple files, following this documentation : https://firebase.google.com/docs/functions/organize-functions?gen=1st#...
0
votes
1
answer
61
views
Rmd file which sources an R script which sources another R script
To make my code modular, I wrote a R script for plotting data, which invokes an R script to prepare the data (to be plotted):
The document.Rmd file contains a line source('./R/customPlot.R') and this ...
0
votes
0
answers
59
views
How to perform service logic in DTO response object?
I am beginner in programming and develop my pet project in ASP.NET Core MVC for learning English words. I want to perform calculations based on other properties of the word and get priority of the ...
2
votes
2
answers
1k
views
"ModuleNotFoundError" when importing modules
A similar question was asked at: Python subpackage import "no module named x"
But I was still not able to solve my problem.
For the first time, I divided my python code into modules and ...
0
votes
0
answers
43
views
GAS files: how to free global space from polution?
How do I clean up my global space without having to create +1000 lines .gs files
Here follows two photos of some of my files/folders. Mind how low the scroll bar can slide (30+ GAS files) ↓
In ...
2
votes
0
answers
254
views
Good practice when organizing React functional component code (functions, splitting...)
Is there a better solution when it comes to splitting code into sub components, and to writing functions called in render ? For example would it be better to have
const CustomRow = ({ row = {}, ......
-1
votes
1
answer
113
views
How to keep naming conventions clear?
I try to get my code organised and DRY to scale with flexibility. Do Flux, Reflux, etc. use certain naming conventions?
I try to build a file structure with atomic design patterns in React.js.