Click here to Skip to main content
15,887,596 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: How to find all files of a certain type in Memory? Pin
Sonhospa7-Apr-16 5:03
Sonhospa7-Apr-16 5:03 
QuestionC++ code which is callable from C#, returns a Stream and maintains state. Pin
Duncan 8429-Mar-16 10:52
Duncan 8429-Mar-16 10:52 
AnswerRe: C++ code which is callable from C#, returns a Stream and maintains state. Pin
Nathan Minier30-Mar-16 1:16
professionalNathan Minier30-Mar-16 1:16 
AnswerRe: C++ code which is callable from C#, returns a Stream and maintains state. Pin
jschell31-Mar-16 9:40
jschell31-Mar-16 9:40 
Questionhow to design this scenario? Pin
girishmeena15-Mar-16 9:34
girishmeena15-Mar-16 9:34 
AnswerRe: how to design this scenario? Pin
Richard MacCutchan15-Mar-16 10:42
mveRichard MacCutchan15-Mar-16 10:42 
AnswerRe: how to design this scenario? Pin
jschell31-Mar-16 9:44
jschell31-Mar-16 9:44 
SuggestionWhat if “static” is inferred? Pin
MathuSum Mut24-Feb-16 10:39
professionalMathuSum Mut24-Feb-16 10:39 
In most object-oriented programming languages (such as C#, Java and Visual Basic .NET), static signifies that the method or field does not exist on a particular instance in the application. Static methods/fields must only depend on their parameters and/or other static contexts, a single instance of whom will exist throughout the application lifetime.

The following only for programming languages that compile libraries to object code and not native assembly code:

In executable assemblies, staticity can be inferred automatically using the following rules:

1. A method (or property) should be marked as static if and only if its uses only compose of its parameters and/or static fields, provided it does not override a base method/property.

2. A field should be marked as static if and only if it is never accessed through an instance.

There are advantages and disadvantages to the inference approach:

Advantages:

1. No need to specify static explicitly, which may simplify work when refactoring code.
2. Code noise is reduced.
3. Accidental omission of static for methods is catered for, speeding up method access (refer to Performance of using static methods vs instantiating the class containing the methods).

Disadvantages:

1. If the code is not devised clearly, the code may be harder to understand. Proper code structure should be maintained. Also, method names should clearly represent the intention of whether the method should be static or not.

2. Compiler errors and warnings would have to be more clear, showing clearly what caused staticity inference conclusion to change, if present.

3. For libraries, static should still be programmatically specified, in order to make sure that deviation from the original usage intention is not permitted, unless stated otherwise...

If a library was to allow static to be inferred, then the compiler would omit specification in the object code, and the compiler/interpreter of the executable has to infer them by analyzing the code of itself and the referenced assemblies, generating staticity specifications to any fields, methods or properties that lack it.

Static classes are really easy to infer. A class can only be static if and only if it only contains static fields, methods and/or properties.

The question is: Why is automatic staticity inference not implemented in any popular language, not even optionally?

I think there are various situations that would benefit from such a feature.
Yours truly

GeneralRe: What if “static” is inferred? Pin
jschell6-Mar-16 8:19
jschell6-Mar-16 8:19 
QuestionEsb experiences Pin
Tom Wauters22-Feb-16 6:59
Tom Wauters22-Feb-16 6:59 
AnswerRe: Esb experiences Pin
jschell6-Mar-16 8:24
jschell6-Mar-16 8:24 
GeneralRe: Esb experiences Pin
Tom Wauters6-Mar-16 11:36
Tom Wauters6-Mar-16 11:36 
GeneralRe: Esb experiences Pin
jschell31-Mar-16 9:35
jschell31-Mar-16 9:35 
QuestionFile Sharing App Proposed Architecture Pin
Kevin Marois10-Feb-16 11:20
professionalKevin Marois10-Feb-16 11:20 
AnswerRe: File Sharing App Proposed Architecture Pin
Richard Deeming11-Feb-16 0:38
mveRichard Deeming11-Feb-16 0:38 
GeneralRe: File Sharing App Proposed Architecture Pin
Kevin Marois11-Feb-16 3:39
professionalKevin Marois11-Feb-16 3:39 
QuestionArchitecture - handling consecutive updates - Azure Pin
Rajeshjoseph9-Feb-16 5:13
Rajeshjoseph9-Feb-16 5:13 
AnswerRe: Architecture - handling consecutive updates - Azure Pin
Eddy Vluggen9-Feb-16 6:45
professionalEddy Vluggen9-Feb-16 6:45 
AnswerRe: Architecture - handling consecutive updates - Azure Pin
Gerry Schmitz9-Feb-16 17:40
mveGerry Schmitz9-Feb-16 17:40 
AnswerRe: Architecture - handling consecutive updates - Azure Pin
jschell12-Feb-16 12:21
jschell12-Feb-16 12:21 
GeneralRe: Architecture - handling consecutive updates - Azure Pin
Rajeshjoseph16-Feb-16 4:55
Rajeshjoseph16-Feb-16 4:55 
GeneralRe: Architecture - handling consecutive updates - Azure Pin
Wayne Stewart_16-Feb-16 13:11
Wayne Stewart_16-Feb-16 13:11 
GeneralRe: Architecture - handling consecutive updates - Azure Pin
jschell19-Feb-16 12:55
jschell19-Feb-16 12:55 
AnswerRe: window application form work in KIOSK Pin
Eddy Vluggen9-Feb-16 6:46
professionalEddy Vluggen9-Feb-16 6:46 
GeneralRe: window application form work in KIOSK Pin
Richard MacCutchan9-Feb-16 7:24
mveRichard MacCutchan9-Feb-16 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.