Note that there are some explanatory texts on larger screens.

plurals
  1. POClass Design Within VB.Net
    primarykey
    data
    text
    <p>-Edit- This is for a finance API I am designing. I am in the process of creating some empty classes, getting a feel for the general structure. My primary concern is designing a pleasant user experience without requiring a manual to explain how to use it. -End Edit-</p> <p>I have been scratching my head trying to think of the best way to go about designing a specific class. I will create a <em>general example</em> to illustrate.</p> <pre><code>Namespace SomeNamespace Public Class Results Public a1 as Integer Public a2 as Integer ... Public b1 as Integer ... Public z1 as Integer End Class End Namespace </code></pre> <p>The example above is generic, but the point is there are many values within the class. The letter in the variable name represents a similar group of results. The "a" results are similar, "b" similar, etc. I had thought to make a class for each type of result value (since they are a type of result, but separate concepts from each other) within the Results class such as...</p> <pre><code>Public Class Results Class a Public a1 as Integer End Class Class b ... End Class End Class </code></pre> <p>The problem with this is that it is not explicit that when a person uses the class</p> <pre><code>Dim ResultObject as new SomeNamespace.Results.a() </code></pre> <p>the Results object would have to be instantiated first, because any of the sub-classes a,b, etc would rely on the Results object. But the user would see the objects a,b, etc and perhaps not know that they must create the parent object first.</p> <p>I thought about making the classes separate and each constructor would create a Result object, but that seems backwards logically. Any Advice? Sorry if it was confusing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload