Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
GeneralRe: foreach Problem? Pin
Paul Riley9-Sep-02 4:45
Paul Riley9-Sep-02 4:45 
AnswerRe: foreach Problem? Pin
Bloody16-Sep-02 23:50
Bloody16-Sep-02 23:50 
GeneralShould I start out on C# (no past experiance)...Few questions! Pin
Vipermmx8-Sep-02 11:28
sussVipermmx8-Sep-02 11:28 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Christian Graus8-Sep-02 11:55
protectorChristian Graus8-Sep-02 11:55 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Paul Riley8-Sep-02 12:05
Paul Riley8-Sep-02 12:05 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Alastair Stell8-Sep-02 15:09
Alastair Stell8-Sep-02 15:09 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Christian Graus8-Sep-02 17:47
protectorChristian Graus8-Sep-02 17:47 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Alastair Stell8-Sep-02 19:47
Alastair Stell8-Sep-02 19:47 
You are welcome to your opinion. I honestly don't know where to start regarding your comments, because what you regard as a virtue I consider a vice, and you no doubt reciprocate the sentiment.

Programmers have argued for years over this kind of topic, and I've never seen anyone persuade anyone! All I can say is that after fourteen years of programming in C++, I found C# to be a breath of fresh air. And at my age I would expect to be resistent to new ideas (I'm 46 tomorrow).

So, rather than disagree with you, I thought I would make a few observations for anyone out there who knows about object orientation, yourself included:

Data has a lifetime. We all know this, and as an analyst I consider data lifetime an important aspect of modelling. However what is not always realized is that data does not die, it simply becomes time-expired. Why is this you ask? Because data is history. If you keep it around and date-expire it, then you can always 'wind back the clock' to see what happened at a particular date and time. It turns out that everyone in the business world likes this sort of thing. Of course we often shunt the data off into shadow database, but it's still there and SQL generators can always recover it.

But data is only a part of the story. Messages between business objects are also a part of history. The sequence in which they flow, their payload, also reflects the history of events.

Which of course leads us to the notion of State. State not only determines what actions an object responds to, it also determines how the object responds. Some people think that State is a simple, ordinal value. Sometimes it is, but that's rare. More often it is a consequence of internal data and external associations. And if you understand all this, you also understand why a method is not the same as a function!

So, all objects, all associations, all methods have implied or actual state, all data and message have an active lifetime, they time expire but they do not truly die.

If this is true in the business world (and I find after twenty four years that it is) then wouldn't it be nice to have a language which models actions and data, state and messaging in this same way? Well, sadly their really isn't. Smalltalk is not bad and can facilitate many of the essential axioms. So too can Java (although I'm not especially fond of the Swing II engine etc). But C++? Yik! It brings nothing to the game except infinte possibilities to succeed... or fail.

C# does not solve all (or indeed many of) the shortcomings of C++, but it is fun to use, simple, and has several embedded object oriented principles such as the Interface pattern and class metadata (reflections etc). You don't have to duplicate your function templates into endless header files, you don't need multiple inheritance ever, not ever at all, and you don't have to worry yourself over endless memory management issues.

For games I imagine that C++ will remain the tool of choice for quite sometime to come, but for anyone in 'experimenting mode' I recommend C#. You can always rewrite the code in C++ because there are patterns in C++ which corrspond closely to the embedded C# mechanisms. But I would be startled if a newcomer could write reliable code, well structure, faster in C++ than in C#.

In the business world I'll try my best to avoid C++ from now on. I can read almost anyone's C# code, no matter how complex, but I've seen case of 34 way multiple inheritance in C++ (telecoms, VOIP) which it took me three months to truly figure out. I don't want to go back there, and I'll gladly cede you that domain.

And no, although we use C++ in telecoms, we always preallocate 100% of worst-case memory requirements because we simply cannot allow any memory leaks. For this reason we cannot use any version of MFC because this library has more holes than a camel has fleas. So we use STL, STL2, ATL etc., and for speed, coding efficiency and some beautiful virtual abstractions of communication protocol layers, we use every technique that C++ offers. Especially, it seems, multiple inheritance.



Only change is constant
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Joaquín M López Muñoz9-Sep-02 0:01
Joaquín M López Muñoz9-Sep-02 0:01 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Stephane Rodriguez.8-Sep-02 19:13
Stephane Rodriguez.8-Sep-02 19:13 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Ryan Cromwell10-Sep-02 18:56
Ryan Cromwell10-Sep-02 18:56 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Alastair Stell8-Sep-02 20:04
Alastair Stell8-Sep-02 20:04 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
leppie9-Sep-02 1:38
leppie9-Sep-02 1:38 
GeneralRe: Should I start out on C# (no past experiance)...Few questions! Pin
Vipermmx9-Sep-02 4:37
sussVipermmx9-Sep-02 4:37 
GeneralSingle instance problem Pin
Tomji8-Sep-02 10:52
Tomji8-Sep-02 10:52 
GeneralRe: Single instance problem Pin
yonjuro8-Sep-02 19:28
yonjuro8-Sep-02 19:28 
GeneralRe: Single instance problem Pin
Tomji9-Sep-02 11:11
Tomji9-Sep-02 11:11 
GeneralAvailable Controls Pin
Nnamdi Onyeyiri8-Sep-02 7:27
Nnamdi Onyeyiri8-Sep-02 7:27 
GeneralRe: Available Controls Pin
Stephane Rodriguez.8-Sep-02 7:57
Stephane Rodriguez.8-Sep-02 7:57 
GeneralRe: Available Controls Pin
leppie8-Sep-02 7:58
leppie8-Sep-02 7:58 
GeneralRe: Available Controls Pin
Mazdak8-Sep-02 10:34
Mazdak8-Sep-02 10:34 
QuestionThrowing exception when a property must not be null? Pin
Martin Haesemeyer7-Sep-02 23:56
Martin Haesemeyer7-Sep-02 23:56 
AnswerRe: Throwing exception when a property must not be null? Pin
Paul Riley8-Sep-02 0:33
Paul Riley8-Sep-02 0:33 
GeneralRe: Throwing exception when a property must not be null? Pin
Martin Haesemeyer8-Sep-02 0:39
Martin Haesemeyer8-Sep-02 0:39 
GeneralRe: Throwing exception when a property must not be null? Pin
Paul Riley10-Sep-02 4:50
Paul Riley10-Sep-02 4:50 

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.