Questions tagged [code-organization]
Code organization is the way how code is placed in a project.
615
questions
0
votes
0
answers
16
views
Connecting single solution's projects to each different repo on VSTS
Is there a way that we can map(connect) a single solution's projects to the VSTS organization's projects?
That is for every single project there should be one project present in the Organization with ...
1
vote
0
answers
20
views
What is the most convinient way to organize the Typography and the Colors files?
I have a React Native Project (+ Typescript), where I collect all the StyleSheet values for Typography in one separate file (Typography.ts). It looks something like this:
const typography = {
...
0
votes
0
answers
11
views
Split React PureComponent code so functions are in different file
how can I Split React PureComponent code so functions are in different file so It´s more clean, organized and easy to read?
Let´s say I have this component
import { PureComponent, createContext } from ...
0
votes
0
answers
27
views
Problems with import, __init__.py with .ipynb
I'm a beginner organizing my code properly in python and I am struggling a bit doing imports in my main .ipynb from a .py script.
My folder is organized as it follows:
| naive.ipynb
| requirements....
2
votes
0
answers
37
views
Flutter - ordering Widget class members
In the following section of the Flutter style guide it suggests to put the widget's build method after all other methods, even the private ones that the build method uses. In theory it collides with a ...
0
votes
1
answer
35
views
Unique or Multiple Controllers
I'm doing an app in PHP with a lot of table and I would like to organise properly my code (without framework).
The question is about controllers.
I have tables for person, region, cities, countries, ...
-1
votes
1
answer
91
views
Python: save 100 functions in the same file or in separate files? [closed]
My main program calls 10 script files that serve as subprograms. Every script file calls about 20 of my 100 self-written functions. Is it advisable to write all the 100 functions in a large file or is ...
0
votes
1
answer
60
views
Organizing JavaScript Variables in VsCode?
Looking for a way to organize variables inside vsCode. Similar to the way that you can collapse a function in the workspace, I would like to be able to collapse a long list of variables ...
var x = 1
...
1
vote
1
answer
114
views
Making paragraphs for the outline using comments in vscode
Is it possible to use comments to organise the code in paragraphs that could be available in the outline.
This would be helpful for organizing classes with a lot of methods.
I would be in particular ...
1
vote
1
answer
97
views
Why does Kotlin allow package structure that does not match folder structure?
Kotlin packages are written package one.two.three, and they usually match the folder structure (e.g. one/two/three) of the project, but they don't have to match the folder structure. What is the ...
-2
votes
2
answers
120
views
How can i make my function run even more faster?
Hey guys I was doing a problem-solve I did a lot of changes to my first function to hit the time limit
but this is really my last idea I don't know how to make it faster than right now
from timeit ...
-4
votes
2
answers
78
views
Hashmap key inside value object paradigm [closed]
I have this design pattern that occurs whenever I use maps. I find myself having the key of the map also inside of the value. For example:
private Map<UUID, PlayerData> allPlayerData = new ...
0
votes
1
answer
837
views
With AWS CDK Python, how to create a subdirectory, import a .py, and call a method in there?
I am attempting to get the simplest example of creating a S3 bucket with the AWS CDK Python with no luck.
I want to put the code to create the bucket in another file (which file exists in a ...
0
votes
0
answers
19
views
Structure and Organizationg in Github?
I'm working as a developer for a small company. Currently, none of our source code is under version control. We have a lot of small programs to manage. I'm considering setting up version control ...
0
votes
1
answer
117
views
Create Shortcut For Code Folding Curly Brackets
I use the curly brackets {} to help organize my R-code. The collapse/expand all macro does not work on curly brackets. I am aware that I could make addins and assign them to a shortcut / keybinding. ...
3
votes
0
answers
55
views
Is it possible to declare two interdependent classes each in a separate file?
I have two PowerShell classes that are inter-dependent:
Class A:
class A {
[int] hidden $i
[B] hidden $b_
A([int] $i) {
$this.i = $i
}
[void] set_b([B] $b) {
$this.b_ = $...
1
vote
1
answer
168
views
How to manage codebase rights with a monorepo?
I need your advice about codebase management and security. I have a monorepo that contains:
Several backend services.
Frontend projects like the landing page, the users’ documentation, and the web ...
1
vote
0
answers
24
views
Visual Studio Community Centralizing 3rd party dlls for reference
Hello I'm trying to learn how to build my own library (using SDL2) that I can use for other projects in the same solution. I know how to set up a project that others can reference for libraries and ...
1
vote
1
answer
59
views
How to automatically structure java class source code?
I am looking for a way to quickly organize source code within java classes, preferably have the different sections such as fields, methods, etc. in alphabetical order and within their own section. I ...
0
votes
1
answer
66
views
How to find the optimal git concept for my style of working
I'm currently cleaning my dev environment and looking for a good way to organize my code via git's concepts. For reasons too long to explain, the structure of my project looks like this:
independent ...
3
votes
1
answer
143
views
Access private functions from private functions in Octave [BUG]
In Matlab private functions are those stored in subdirectories with the name private. They have a restriction of visibility that: "you cannot call the private function from the command line or ...
0
votes
1
answer
101
views
How do i organize a GTK program?
I have a function called create_interface. In that function is a signal handler for the Open menu button (the menu is created in create_interface). I want to pass the window widget and also pass along ...
1
vote
1
answer
705
views
How to organize unit tests in googletest efficiently
I am currently thinking about restructuring the unit tests in my project. I use Googletest as testing framework. My project consists of several shared libraries that are built and tested together.
As ...
3
votes
0
answers
110
views
Folder cross reference in a Python project [closed]
I have a Python project folder which looks something like this:
|- main.py
|- data
|- out
|- tests
|- src
|- utils
|- etc...
Now imagine that inside the source code in src I need to ...
-1
votes
1
answer
38
views
Organize multitrheading datalogging [closed]
I'm working on a C project for an embedded target running a Linux distribution (build with Yocto). I'm new to Linux embedded world and I have to build a data logging system.
I'm already learning how ...
0
votes
1
answer
21
views
Better to use data from table on page or from a pre-made javascript variable - PHP/Javascript
I found a few questions that were close, but not quite what I needed, so I'm sorry if this has already been asked.
I have a page with a table filled in with PHP using data from a database. The user ...
0
votes
0
answers
73
views
wxWidgets - Splitting project into multiple files
I am very new to C++, I'm making this music application using wxWidgets, this is my first project in C++. As of now, I have 4 files, app.hpp and app.cpp which has a class that inherits from wxApp that ...
2
votes
0
answers
117
views
How to split a procedure in few parts
I'm having inside a textbox textchanged event a long procedure and I'd like to make it easier and lighter.
So, I'm trying to check what clipboard has and if it respect some parameters, it can goes ...
1
vote
0
answers
639
views
Clean coding an HTML text-adventure game
I'm building a text-based adventure game using HTML5, CSS and JavaScript but before I too far ahead of myself I was wondering how I should go about organizing my files. I was thinking rather than ...
0
votes
1
answer
40
views
Organization method for handling routing between many methods
This may be a matter of opinion, but since I'm mostly self-taught, I'd like to ask for advice. I have an input and then a routing method and then individual methods to handle the routing like so:
# ...
3
votes
1
answer
214
views
How to synchronize parametrization across pytest fixtures?
I have two fixtures A and B with the same params argument passed to pytest.fixture(). Additionally, B takes A as an argument:
import pytest
@pytest.fixture(params=[1, 2])
def A(request):
if ...
1
vote
2
answers
63
views
A cleaner way to pass many parameters into many functions in a script, without moving to object-oriented code structure?
I am looking for some style/best practice advice. I often find myself writing scripts which need many (several tens of) parameters to be defined at the beginning. Then these parameters are used by ...
2
votes
2
answers
827
views
How to properly organize "helper" methods for a class method
I have a Python class that has several "major" methods, which successively modify one of its attributes, e.g.
def method1(self):
# modify an attribute of self
return self
def ...
2
votes
2
answers
77
views
How to quit Jupyter and become a better programmer? [closed]
I am a self-taught programmer coming from a scientific (non-programming) background. I discovered Jupyter early after I started using Python. And although I greatly enjoy using it (Jupyter), I feel ...
0
votes
2
answers
53
views
How to achieve "neat" line breaking for several arguments in Python + VSCode?
I am new to Python and I couldn't find the answer for this precise question elsewhere. Let's say one is using a Python function with several inputs. Ideally, for readability, I would like to write ...
1
vote
1
answer
64
views
How to have a good project code organization in Xcode?
My project i becoming messy because of the number of files, i need advices from devs.
For exemple i have string extensions, at start i was creating one per target. One for ios, one for watch OS etc ......
0
votes
0
answers
68
views
Tight coupling and ES6 modules
I'm starting to learn about JavaScript code organization using ES6 modules and webpack. Something I don't understand is how using them is possible without making the modules tightly coupled to each ...
0
votes
0
answers
480
views
Separating the logic and the render() function from a component
I would like to be able to have a component whose rendering function is in another file in order to have a separation between the logic of my component and the rendering.
Naively, I tried to do just ...
0
votes
1
answer
36
views
Datatables.js - Better Organization of Columns but still need to sort from Header
For this project, I'm using the latest version of DatatTables.js
The table I want to incorporate as a LOT of columns, and I'm looking to consolidate some of those into one cell, BUT I still want to ...
0
votes
0
answers
171
views
How to properly organize interfaces and implementations in Java modular project?
I am looking for a way to properly organize interfaces and implementations in Java 11 modular project.
Considering the simplest case: there is an interface and its multiple implementations. The ...
6
votes
1
answer
1k
views
Cross-module function call in Rust
I'm trying to call a function belonging to some module from another module (for code factoring, organization, etc).
Here is my crate structure:
➜ mod_test git:(master) ✗ tree
.
├── Cargo.lock
├── ...
4
votes
3
answers
721
views
Import diagram/structure inside a python folder (clean-up code)
I just finished a middle-sized python (3.6) project and I need to clean it a bit.
I am not a software engineer, so during the development, I was not too accurate structuring the project, so now I have ...
0
votes
1
answer
203
views
Why put frames and widgets in classes?
As the question states, I can't seem to fully grasp the point of using classes with tkinter.
I have read through a decent number of different sites but I keep getting search results on how to create ...
0
votes
0
answers
259
views
SASS partials: to be or not to be
Any soild reason I should prefer the sass partials over normal sass files (w/o leading underscore in the filename)?
I am not a full-time frontend developer and for now I use sass for simple ...
0
votes
1
answer
164
views
Creating multiple widgets within a class frame
In simply trying to work on organizing my code, I've found online that it seems to be best to put much of your code into classes when needed. So in doing that, I'd figure that I'll try to create a ...
0
votes
1
answer
72
views
Where to put code that create multiple objects after one is created
It is a question about how to organize code, I can't decide what is best and I did not find clearly what would be the best practice in the following case:
I have model A. After create, I need to ...
3
votes
1
answer
189
views
In matlab, is it possible to put methods of classes organised in folders in subdirectories/subfolders?
I am new to the option of organising your classes in class folders in matlab. In terms of readability, my code benefits from putting methods of the class in separate files, because oftentimes the ...
6
votes
4
answers
274
views
How to bring a </div> closer to its <div> using React/Angular/Vue?
Prelude
Seasoned C (say) developers will squirm at the sight of a 200-line function. They will strive to divide it into (say) ten functions of 20 lines each. Loosely speaking, the objective is for a ...
0
votes
2
answers
30
views
JQuery Select on change code organization
I am working on an application where the page has multiple images that are clickable, and a form text field that is editable, and all of these fire a Jquery functions with Ajax calls, and everything ...
1
vote
1
answer
969
views
Organising utility functions
This is more of a best practice question than a coding question. I have written a project, within the project I have some "helper functions". I have put them into a separate class and each function is ...