Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#284013 - 04/07/2006 20:04 C# - Toy or Serious Language?
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Are there any major applications out there that are written in C#? By that I mean things that have major performance requirements, say something like PCB design software which could draw hundreds of thousands of geometric primatives per refresh.

I'm asking because I'm sitting in no-mans-land, I have no idea what applications should be written in. It seems that C is seriously becoming a fifth class citizen and accessing the operating system internals is becoming increasingly more difficult, I suspect even more so with the the release of vista around the corner (and down the road, over the bridge and far away ).

I kind of get the feeling that Microsoft themselves don't quite know where they're at. If it seems that C# doesn't cut the mustard when it comes to performance, then what the hell are you supposed to do?

I've played with various GUI toolkits, and everyone I've tried under .NET is unbelieveably slow, conversely the C++ GUI toolkits are fast, snappy and don't have any of the issues I see with the .NET versions.

At the back of my mind I also have cross platform lurking, I pretty much put the cross platform toolkits out of the window because of the clunky "not quite right" interfaces that you end up with. I'd rather implement the backend software in a platform independant library and write GUI code for each platform as required, more effort but you end up with native software.

I know there's probably a few C# gurus on here, so I'd like to have some feedback about this language.

Thanks.

Adrian

Top
#284014 - 05/07/2006 02:51 Re: C# - Toy or Serious Language? [Re: sn00p]
DWallach
carpal tunnel

Registered: 30/04/2000
Posts: 3810
I've got two undergrads doing a summer project in C# (building me a software voting machine). This is with students who know Java well but didn't previously know C#. Why? Because C# is theoretically portable (eventually) to an Xbox 360 (thus making for a clever, low cost voting machine). Turns out, the Mono people are way behind the Microsoft people, in terms of supporting the latest and greatest language features (notably templates, which were added in .Net 2.0 as well as apparently significant library support). I haven't dug into this much yet, myself, but my students are convinced that the new features in .Net 2.0 are essential.

As such, if you write with C#, you accept portability as a problem. What you get back is much better integration with the Microsoft universe of COM objects. Also, unlike Java, the language knows about arrays of structures and will allocate them inline, unlike Java which allocates an array of pointers to class instances. As such, if you've got "high performance" needs, and by that you mean to process large arrays of data, C# gives you much more control over what your data looks like in memory. That, all by itself, may be a significant reason for going with C#.

Top
#284015 - 05/07/2006 04:13 Re: C# - Toy or Serious Language? [Re: sn00p]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
I have no idea what applications should be written in.


Depends on the application, as always.

If you're looking for high performance, then C# might not be what you want. If you're looking for a robust, garbage-collected, well-thought-out language, with a huge class library, and good IDE support (at least on Windows), then give C# a look.

Personally, I use both, depending on my needs.
_________________________
-- roger

Top
#284016 - 05/07/2006 05:20 Re: C# - Toy or Serious Language? [Re: Roger]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:

Depends on the application, as always.

If you're looking for high performance, then C# might not be what you want. If you're looking for a robust, garbage-collected, well-thought-out language, with a huge class library, and good IDE support (at least on Windows), then give C# a look.

Personally, I use both, depending on my needs.


Obviously this is true, but it seems that C no longer cuts it when accessing the latest and greatest features of the operating system, I can't see this getting any easier with the release of vista.

I think what I'm trying to get at is that they've effectively depreciated 'C' as a language without having a native alternative that allows access to all the latest operating system features.

Mac OS X has objective 'C' but Microsoft appear to have nothing. I feel that implementing anything in 'C' on the MS platform is now a waste of time/effort because of it's apparent status.

Now if they were to build a native C# compiler and C# libraries (assemblies? not 100% on this terminology, but I assume then .NET libraries are also interpreted) then they might have a viable alternative to 'C'.......

3 Years ago MFC was dead (not that I've ever used it in anger), now they appear to be saying that it's alive and well and that they're going to be making improvements to it, is that a backtrack? Is that MS admitting that .NET is useless for anything other than trivial applications?

Adrian

Top
#284017 - 05/07/2006 06:42 Re: C# - Toy or Serious Language? [Re: sn00p]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
I think what I'm trying to get at is that they've effectively depreciated 'C' as a language without having a native alternative that allows access to all the latest operating system features.


That's 'deprecated'.

And there's C++, which provides access to all of the C APIs, all of the COM APIs, and all of the .NET APIs (either through COM interop, or through Managed C++ or C++/CLI).

Quote:
Is that MS admitting that .NET is useless for anything other than trivial applications?


No, they're saying that lots of people still have a tremendous investment in MFC source code, and so they'll be making improvements to it if needed. As far as I'm aware, the only improvements made in MFC 8 (i.e. Visual C++ 2005) were support for hosting and being hosted by WinForms widgets.


Edited by Roger (05/07/2006 06:45)
_________________________
-- roger

Top
#284018 - 05/07/2006 06:44 Re: C# - Toy or Serious Language? [Re: sn00p]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Quote:

Now if they were to build a native C# compiler and C# libraries (assemblies? not 100% on this terminology, but I assume then .NET libraries are also interpreted) then they might have a viable alternative to 'C'.......



Plenty of the .NET framework in Windows is just wrappers round the native OS code. Also, C# isn't really interpreted as such. It all ends up being converted to native code in the end.

In my experience C# is fast enough for most purposes. I wouldn't want to write a game, a hugely graphics intensive app, device drivers or a database engine in it. For most other things it is fine.

I haven't used C# to draw hundreds of thousands of elements. I have however used it to draw thousands of elements at a time (to display musical scores). I drew the display using GDI+ rather than controls, which would have been slow.

My OSX version of the same UI, using Objective C was no faster, though that might be more a reflection of my Objective C skills or the speed of my pre-Intel Mac Mini...
_________________________
Remind me to change my signature to something more interesting someday

Top
#284019 - 05/07/2006 09:57 Re: C# - Toy or Serious Language? [Re: sn00p]
DWallach
carpal tunnel

Registered: 30/04/2000
Posts: 3810
Also keep in mind that you don't have to write your application entirely in a single language. You could use C/C++ for the performance critical bits and export a COM interface that C# can use, then building your GUI and everything else in C#.

Top
#284020 - 05/07/2006 10:32 Re: C# - Toy or Serious Language? [Re: DWallach]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
And likewise, if your UI drawing code needs to be super fast you can hand off the window handle to a native C/C++ component to do the drawing.
_________________________
Remind me to change my signature to something more interesting someday

Top
#284021 - 05/07/2006 11:01 Re: C# - Toy or Serious Language? [Re: Roger]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Quote:
Quote:
I think what I'm trying to get at is that they've effectively depreciated 'C' as a language without having a native alternative that allows access to all the latest operating system features.


That's 'deprecated'.



Well, maybe, maybe not. Depreciate roughly means "to decrease the value of". Deprecate approximately means "express wish against or disapproval". Recent popular (mis)usage of the latter is now infringing upon the definition of the former, depreciating its value and resulting in deprecating posts like Roger's.

Top
#284022 - 05/07/2006 13:44 Re: C# - Toy or Serious Language? [Re: mlord]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
"Deprecate" is the appropriate term. For one thing, "depreciate" is seldom, if ever, used to indicate the reduction of an abstract value. (That's off the top of my head; correct me if I'm wrong there.)

More importantly, while it may fit in this particular usage, in common computerese usage, what they're referring to may have nothing to do with a lessening of value, but an admonishment to not use it for some other reason. Most things have been deprecated still function perfectly well, but the designers have decided that you should do it a different way, and that way may have more to do with their notions of style than any technical reason. This is often the case where methods have been moved to new namespaces.

In addition, many of those things that have been deprecated have replacements that have more function, and that is not due to a lessening of function of the old thing, but additional functions for the new thing. For example, PHP deprecated $HTTP_SERVER_VARS in favor of $_SERVER. $HTTP_SERVER_VARS still functions as it always did, but $_SERVER has a greater scope.
_________________________
Bitt Faulk

Top
#284023 - 05/07/2006 15:50 Re: C# - Toy or Serious Language? [Re: sn00p]
JeffS
carpal tunnel

Registered: 14/01/2002
Posts: 2858
Loc: Atlanta, GA
Quote:
Are there any major applications out there that are written in C#? By that I mean things that have major performance requirements, say something like PCB design software which could draw hundreds of thousands of geometric primatives per refresh.

I think you and I might define "major applications" differently. There are plenty of major business apps where code clarity and maitenence is more important than performance. C# is excellent for these types of applications and is used for many of them. Right now I am working on a huge web app for a bank primarily written in C#, and I think that C# is definitely a solid solution for this particular task.

It is definitely not a "toy" languge, but neither is it the right technology for every application. As always, gotta pick the right tool for the right job.
_________________________
-Jeff
Rome did not create a great empire by having meetings; they did it by killing all those who opposed them.

Top
#284024 - 05/07/2006 17:17 Re: C# - Toy or Serious Language? [Re: JeffS]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Thanks guys, but still none the clearer really! Despite spending the last 6 or so months doing embedded stuff pretty much exclusively, we also write PCB design software - hence my questions about speed! COM is a nasty mess in C (or C++) especially when dealing with variants, obviously this all disappears under C#. Things are further complicated that our application is Win32 api & up until last year was C++ free, I only turned to C++ when I needed to wrap up and hide some COM horrors for msxml.

With regards to deprecated, I used the Ctrl+Apple+D dictionary when I wrote deprecated initially and it said:

1. express disapproval of
2. another term for depreciate (sense 2)

So I looked at depreciate and the sentiment I was trying to get across was covered under depreciate.

I love this place

Top
#284025 - 05/07/2006 20:21 Re: C# - Toy or Serious Language? [Re: wfaulk]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:
"Deprecate" is the appropriate term. For one thing, "depreciate" is seldom, if ever, used to indicate the reduction of an abstract value. (That's off the top of my head; correct me if I'm wrong there.)



At least over this side of the pond, depreciate is used to describe something losing it's value, most frequently in regards to car value, "depreciation" is something which causes grown men and women to cry!

Top
#284026 - 06/07/2006 00:04 Re: C# - Toy or Serious Language? [Re: sn00p]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Yeah, it's used that way here, too, but that has a specific, concrete monetary value associated with it.
_________________________
Bitt Faulk

Top
#284027 - 06/07/2006 04:53 Re: C# - Toy or Serious Language? [Re: sn00p]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
Thanks guys, but still none the clearer really!


That's because you've assumed that there's a definitive Right Answer to your question. There isn't. It's horses for courses.

Quote:
PCB design software - hence my questions about speed!


As I understand it, there are at least two performance hotspots in PCB design software: the graphics and the auto-layout stuff.

For those, my gut feeling is that you'll want to use C++, because it compiles to native code. It might not hurt to try some of that in C#, though. The performance is pretty good, but -- because it does lots of stuff for you under the hood -- there are performance pitfalls that you might not be expecting.

If you want to start using C# -- and you've not said why C/C++ is no longer suitable for what you're doing -- you can have both unmanaged C++ and C# in the same application, which means that you can get the productivity of using C#, and still use C++ for the performance-critical bits.

Quote:
COM is a nasty mess in C (or C++) especially when dealing with variants


In C, I agree with you. In C++, most of the nastiness goes away if you use #import, or if you use <comdef.h>

Quote:
hide some COM horrors for msxml.


Ah, well, the MSXML API is a little baroque. System.Xml in .NET is cleaner, but not spectacularly so.
_________________________
-- roger

Top
#284028 - 06/07/2006 08:36 Re: C# - Toy or Serious Language? [Re: sn00p]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Well, the rather obvious solution here is to use a portable programming language for as much of the application as possible. No point in locking your product into a single manufacturer's system, especially as design engineers generally prefer better OSs than that one. This pretty much rules out C#, as it's not portable.

Cheers

Top
#284029 - 07/07/2006 15:55 Re: C# - Toy or Serious Language? [Re: mlord]
ninti
old hand

Registered: 28/12/2001
Posts: 868
Loc: Los Angeles
If you are looking for an example of a graphics program using .Net, look at Paint.Net. It's not up to Photoshop yet, but it's a very decent program.

I don't do graphics stuff with .Net, but my coworker does, and his opinion is that while it's performance is not quite as fast as C++ for that kind of thing, it's not that far behind, and a hell of a lot quicker and easier to write.

Honestly, I have yet to see a good solution for portability. I hate Java with the kind of passion that only comes with familiarity, and the loosely typed languages like Perl or Ruby that are popular in Unix are absolutely the wrong way to go IMHO. And neither those nor anything else are really all that portable except for the simplest of tasks. Really the only succesful and usable portable applications I can think of (Gimp, Inkscape, and Firefox) are all still done in C++ I believe.
_________________________
Ninti - MK IIa 60GB Smoke, 30GB, 10GB

Top
#284030 - 07/07/2006 16:28 Re: C# - Toy or Serious Language? [Re: ninti]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:
If you are looking for an example of a graphics program using .Net, look at Paint.Net. It's not up to Photoshop yet, but it's a very decent program.

I don't do graphics stuff with .Net, but my coworker does, and his opinion is that while it's performance is not quite as fast as C++ for that kind of thing, it's not that far behind, and a hell of a lot quicker and easier to write.



That's a different type of graphics application, the problem with applications like PCB software is they have a lot of vectors that need plotting, which although simple, makes it a much more processor intensive task than say photoshop.

Don't get me started about java!!!

I'm going to have a play with C# this weekend, mainly because I'm curious about the fuss!

Top