Questions tagged [code-structure]

Code Structure regards the way that code is written to allow it to be best read, maintained and organized for efficiency. Decisions such as when classes should be used, and which patterns would be most efficient for a task.

This is a cross-language discipline that allows code to be read and maintained easier. In some areas, such as simple web design, this may relate simply to best practices, such as creating your CSS using a separate file, and then organising this in a way that makes the most sense (starting with a browser reset, then the structure, and then into areas such as fonts).

In more complex languages, however, this also involves the use of patterns to be most efficient, and removing duplicated code and overall making your application appear much simpler.

204 questions
-1
votes
2 answers

How can I structure code accordingly (in headers and source files) so I don't get compiler and linker errors?

I am currently doing the exercices in Bjarne Stroustup "Programming Principles and Practice Using C++" and I finished the 8th chapter, where he talks about headers and namespaces. Using this knowledge and other online resources, I tired…
-1
votes
3 answers

Member function that returns a doubly-nested class inside itself which inherited from a class inherited from itself

Say I have 3 classes with following topology, and the actual code is somehow like this: // formal system.h #pragma once namespace nianyi { class Proposition { public: class Term; class Expression; // Term::Value…
-1
votes
2 answers

How to handle huge view controllers so code is not dirty?

I'm having a problem with the app I am developing right now : one of my UIViewControllers is huge ( around 3000 lines ). For now, I created extensions of this view controller to handle delegate methods in order to "split" this controller. For…
Randy
  • 4,335
  • 3
  • 30
  • 64
-1
votes
1 answer

How to manage Android Studio code in a structured way

just want to ask is there any tutorial on how to structure Android Studio coding? i'm new in Android Studio, looking for some best practice to manage our code. Thanks so much.
Sunny
  • 3
  • 3
-1
votes
2 answers

In what package should a "Settings" class be placed?

I'm in the middle of building an application but found myself too easily creating new packages without keeping the project's structure in mind. Now, I'm trying to redo the whole project structure on paper first. I am using a Settings class with…
Tom
  • 8,536
  • 31
  • 133
  • 232
-1
votes
2 answers

Ancient ASP.NET structure, tell me how to do it right

I'm pretty new to ASP.NET and I think im not using it they way it's meant to be used with all the features packed into the latest .NET framework. I'm currently using .NET framework 4,0. There are some error in the code, don't mind them mind they way…
8bitcat
  • 2,206
  • 5
  • 30
  • 59
-2
votes
2 answers

Destructure a for loop

The problem set : Letter combinations of a phone The solution I had in mind: def letterCombinations(self, digits: str) -> List[str]: if not digits: return [] digit_map = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', …
Jerry
  • 366
  • 4
  • 22
-2
votes
1 answer

The structures or STL containers?

Which approach is better to use in C++ to create the type House, struct Coord { double latitude; double longitude; }; struct House { string number; // example: 17A vector coordinates; bool…
Alex Bomb
  • 63
  • 3
-3
votes
1 answer

what are the different bettween the two style of code(none-determined finite state machine simulator)

I have two implementations of a non-deterministic finite-state machine: common definitions edges = { (1, 'a') : [2, 3], #this was the finite state machine (2, 'a') : [2], (3, 'b') : [4, 3], (4, 'c') : [5]…
李航宇
  • 1
  • 3
1 2 3
13
14