Questions tagged [class-structure]

39 questions
123
votes
2 answers

C#: List All Classes in Assembly

I'd like to output (programmatically - C#) a list of all classes in my assembly. Any hints or sample code how to do this? Reflection?
Alex
  • 75,813
  • 86
  • 255
  • 348
16
votes
1 answer

How to build a class structure, when members are also structured hierarchically?

I'm building a PHP web application, that should provide to the user a possiblity to order an "installation"/setup of a (ConnectDirect or File Transfer Gateway) connection between him and another person/organization. (The technical specifica of the…
automatix
  • 14,018
  • 26
  • 105
  • 230
5
votes
2 answers

How many Stateless Widget Classes should a Flutter Developer put in one file?

I'm currently working on a flutter application. I have a file with a big widget tree. In order to easier understand, read and maintain I wanted to "crop" the widget tree. First what I did was to create multiple functions, which represented a bigger…
MuTe33
  • 112
  • 2
  • 13
5
votes
3 answers

if condition in uml class diagram?

if "attribute" is true do this "operation" else do nothing. How do i show this in uml class diagram. Thank you, kim
kim
  • 51
  • 1
  • 1
  • 2
4
votes
0 answers

NHibernate and interfaces with different implementations

I have recently started working with C# and NHibernate so all this is quite novice to me. In the application I'm building I need to calculate distances between UK postcodes. One of the approaches is to use grid reference and Pythagoras…
trailmax
  • 34,305
  • 22
  • 140
  • 234
4
votes
4 answers

Should enum be refactored to a class when more functionality is requested?

At this point I have the following code. internal enum Genders { Male, Female, NotSure, Other } I'm thinking about adding an extra functionality so that I can foreach all the values and return a String based on that. So, I'd go for the…
user1672517
3
votes
3 answers

Help refactor my C# code to be more maintainable and to use best coding practices

I have this C# class structure that I would like to refactor to use best coding standards (use interfaces/abstract classes) so it can be more maintainable and reusable. The code as it is right now isn't awful, but it's not ideal. I have a series of…
apexdodge
  • 6,657
  • 4
  • 26
  • 33
3
votes
2 answers

Best Way to Organize PHP Class Hierarchy

I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure…
Wilco
  • 32,754
  • 49
  • 128
  • 160
3
votes
1 answer

Magento source model conventions

I often see two different methods in a source model that appear to do the same thing: class Mypackage_Mymodule_Model_Source_Generic { /* I sometimes see this method */ public function getAllOptions() {} /* And other times this method */ …
Rick Buczynski
  • 827
  • 8
  • 23
3
votes
3 answers

Separate class for enums?

What is the general consensus towards a separate class in the business layer to store the definition of enums? Is this bad practice? Does this conform to good n-tier design? At the moment my enum definitions are dotted around different, what I would…
user1017882
2
votes
1 answer

Why can't I assign to undeclared attributes of an object() instance but I can with custom classes?

Basically I want to know why this works: class MyClass: pass myObj = MyClass() myObj.foo = 'a' But this returns an AttributeError: myObj = object() myObj.foo = 'a' How can I tell which classes I can use undefined attributes with and which I…
Jacob Lyles
  • 9,920
  • 7
  • 32
  • 30
1
vote
3 answers

C# Array Properties and Class Structure

The current structure of my classes goes a little bit like this: PC.Processor.Architecture[0] = The Architecture of the first processor (assuming a multi-processor system). How I ideally want it is more like this: PC.Processor[0].Architecture,…
Chris Watts
  • 6,197
  • 7
  • 49
  • 98
1
vote
1 answer

Swift: C++ friend Equivalent?

I have a structure similar to the following: class Foo{ class Bar{ ... } private class Baz{ ... } } Foo and Bar need access to Baz, but Baz needs to remain private to both the module and and other modules importing it. Questions: Is there…
Captain Hatteras
  • 490
  • 3
  • 11
1
vote
1 answer

How should i solve a problem with needing to call this() and super() at the same time?

Okay, so, I have a kind of specific problem. I have a class structure similar to this (simplified for simplicity purposes). class A { A() { // long initialization } A(int someValue) { this(); // do something with…
Dipo
  • 23
  • 5
1
vote
2 answers

How do I pass an object in Java from Class B to Class C via Class A without duplication

Let's say I have 3 classes. Class A (extends Activity) Class B Class C (extends View) A creates a B object that holds a Bitmap. A also invalidates C. C's onDraw draws a Bitmap to its Canvas. How do I draw the Bitmap that B holds without creating…
user432209
  • 20,007
  • 10
  • 56
  • 75
1
2 3