C# vs. others

Chat about just about anything else
User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: C# vs. others

Post by Kaye »

ikey wrote:From when we spoke by PM I was of the impression this would be a sensible
argument backed by good facts, but not only by facts. Ideas, real world implementations,
not just bashing a language completely into the ground but showing the good and bad
sides of each. You failed to uphold your end of the bargain :(
Unless such a thing happens with this thread, I will no longer waste my bandwidth. :?
+1. I am tired of talking in circles.
"In somnis veritas"
Antivirus or defragging?
Image

User avatar
eiver
Level 5
Level 5
Posts: 566
Joined: Fri Jan 23, 2009 5:51 am

Re: C# vs. others

Post by eiver »

ikey wrote:Ideas, real world implementations,
not just bashing a language completely into the ground but showing the good and bad
sides of each.
I am sorry, but isn't it the best way to compare different solutions? By showing good and bad sided of each? And then discuss how significant these bad and good sides are? What did you mean by ideas or real world implementations? Actual programs written by someone? I think comparing a language to another one by throwing examples of good programs in a given language is pointless. Doing that can only prove that a language is terrible if actually no good programs have been written in it, but that is not true in the case of any popular language described here. In every language mentioned here there are numerous examples of really good programs.

A programmer can write a wonderful program in every single language discussed here. The question is: Did he enjoy writing it? Would it be easier to do the same thing in a different language? Would it be faster?

As I see it the state of the discussion is the following:
- the strongest argument encountered so far against C# is that MS holds patents on .NET Framework and this is a risk, when we take into account the image of MS (a huge and evil corporation trying to control as much as possible). I could not counter that argument. I think I can weaken it just a bit, but not get rid of it.

- I think I managed to counter all other arguments mentioned in previous posts. If I failed to do so please point out flaws in my thinking (one at a time please :P or the length of each post will grow longer and longer)

P.S.
Did anyone feel offended in any way by anything I wrote here? Thats the last thing I wanted to do.

User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: C# vs. others

Post by Kaye »

eiver,

The issue is that you haven't really countered anyone's arguments anywhere. You're countering by asking questions, which is not a counter at all but rather a distraction from the original point. Also, in your most recent post you say
eiver wrote:Actual programs written by someone? I think comparing a language to another one by throwing examples of good programs in a given language is pointless. Doing that can only prove that a language is terrible if actually no good programs have been written in it, but that is not true in the case of any popular language described here.
But, you just spent a few posts asking me for real world examples of C uses. When I gave them to you, you disregarded them as if they were nothing. In addition to this contradiction you've also displayed a flawed understanding of simple logic (you "rested your case" on logic that proved my point) and a general avoidance of facts.

I think you are well intentioned in this debate, but the fact of the matter is that you are not actually debating anything rather than simply repeating your mantra over and over. This feels nothing like a debate.
"In somnis veritas"
Antivirus or defragging?
Image

Kendall
Level 6
Level 6
Posts: 1121
Joined: Mon Nov 16, 2009 12:20 pm
Location: Hendersonville, NC, USA

Re: C# vs. others

Post by Kendall »

eiver wrote:Sorry I completely forgot, that sarcasm was forbidden on this forum and some people may interpret my responses literally.
Actually a good number of the people who frequent this forum don't communicate well in English. Basically this means that sarcasm (often at it's least obvious in typed form) is often easily interpreted literally. I don't discourage sarcasm on a public web forum in general, but I do discourage it in any situation where there is an elevated probability that the sarcasm will be misinterpreted.
Former Mint Fluxbox/LXDE and Peppermint OS guy.
Senior developer for Ringfree Communications Inc.
Avid trail and ultra runner.

User avatar
eiver
Level 5
Level 5
Posts: 566
Joined: Fri Jan 23, 2009 5:51 am

Re: C# vs. others

Post by eiver »

@Kendall - You are right. I'll try to be more straightforward from now. No sarcasm and no rhetorical questions.

In my previous posts I used a rhetorical method of argument called Reductio ad absurdum. It basically works like that: I assume that your argument is correct. Then I use this argument and show, that it leads to a contradiction or something, which is obviously an absurd for both sides. Doing that proves that the initial assumption was wrong.

You gave an example of why C is better than C#:
Kaye wrote:C is much more powerful and less bloated.
So your complete statement would be: C is better than C#, because its much more powerful and less bloated.
To disprove that statement I did the following:
1. I initially assumed it is correct.
2. I noticed that Assembler is much more powerful and less bloated than C.
3. I used your argument and formed a statement: Assembler is better than C, because is much more powerful and less bloated than C.
Now I only needed to prove that my statement from above is an absurd.
Kaye wrote:By that logic, everyone should be programming in machine code.
Here you agreed that it is an absurd to continue this, so I could only rest my case.

The total corollary from the above is:
Your initial statement is incorrect. You cannot point out that C is better than C# only because its more powerful and less bloated.

The "bloat" you are talking about actually makes it easier to write complex programs. For high-level applications a high-level language is better. There is no point in using an Assembler for things, which can be done in C and there is no point in using C for things which can be done in C#. As I also wrote before, there are very little special cases, where the "power" of C manifests significantly enough to use it.

Actually as automation in software development progresses - a completely opposite argument can be constructed. The more the machine can do for you, the better. This is why C was developed - To make programming easier than Assembler. This is why Java virtual machine was developed - to make programming even easier than C. The same goes for all other high-level programming languages.

You might find interesting that, this does not end at Java or C#. A lot of research is currently being done to abstract from the implementation completely. In that case you would only tell what the program is supposed to do (for example using UML or something similar) and the necessary code would be generated automatically. (A lot of work for software engineers; programmers become obsolete). The next step would be to just specify the general idea for the program and the computer would takeover from there. (That would make software engineers obsolete too). It would need strong AI, so its a complete fiction for now.
Ultimately the whole fun ends, when you turn on your computer and see a message: "Humans are obsolete" on your computer screen. :P

So use C for OS kernel, drivers or embedded systems. When it comes to high-level applications, with which a user directly interacts - use a higher level language. And since I am interested in development of high-level applications in this topic, C shouldn't even be considered.

User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: C# vs. others

Post by Kaye »

So, you completely ignored the entire piece of my argument detailing the intense similarities between C and C# syntax versus the complete difference in thought patterns and hardware knowledge needed to code in machine language or asm. C and C# are easily comparable from a syntax point of view; asm and machine code are not comparable to anything. Your logic is extremely flawed.
eiver wrote:"There is no point in using C for things which can be done in C#."
This is where you are dead wrong. The performance increases that can be realized by using C are considerable. When you compare these increases to the difficulty of programming, a good programmer will see that using C is not much more difficult while providing great speed increases. In software, it's all about speed and stability, both of which can be easily provided by using C. "The more the machine can do for you, the better" is true, but only if the machine can do it as well as you can. C# cannot reach the speeds of C, plain and simple.

Depending on your response, this may be my last post here. C is an infinitely better choice for any kind of application (including a "high-level application", whatever that means) than C#. You cannot keep repeating "C# is easier!!! Easy is good!!!" and have your opinion be respected. Easier in no way means better. Form arguments that make sense and stay on topic.

Please provide a list of advantages that C# has over C. I'm sure your entire list will be trivial.
"In somnis veritas"
Antivirus or defragging?
Image

randomizer
Level 5
Level 5
Posts: 864
Joined: Mon May 03, 2010 7:15 am

Re: C# vs. others

Post by randomizer »

It comes down to your definition of "better." If "easier" is "better" then C# is superior. But if "faster" is "better" then C is superior. I doubt either of you define "better" in such black and white terms in which case we're looking at a spectum of grey (and that's assuming there are no other factors affecting how much "better" a language is other than ease of use and speed). It's a religious debate.

User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: C# vs. others

Post by Kaye »

randomizer wrote:It comes down to your definition of "better." If "easier" is "better" then C# is superior. But if "faster" is "better" then C is superior. I doubt either of you define "better" in such black and white terms in which case we're looking at a spectum of grey (and that's assuming there are no other factors affecting how much "better" a language is other than ease of use and speed). It's a religious debate.
I agree with this statement. Sure, there are situations in which C# is better, otherwise it wouldn't be a popular language.

However, my problem is with eiver's assertion that C# is the best choice for enterprise applications. I don't agree with that at all.
"In somnis veritas"
Antivirus or defragging?
Image

User avatar
Fred
Level 10
Level 10
Posts: 3337
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: C# vs. others

Post by Fred »

I am proud of Kaye. He did quite well in that exchange. :-)

I think you both have begun to get to the crux of the matter. "Better" is like "beauty," it is in the eyes of the beholder. In programing especially, "better" can really only be defined in terms of the specific project requirements at hand. The right tool for the right job. And then it still must be shaped by the skills of the personnel that will be involved in the project.

I have a set of spin-tights that works great to insert and remove the screws in computer cases. I also own a 36" aluminum pipe wrench that is the cat's meow when it comes to breaking a 2 1/2" pipe joint. They are both the "best" tools for professional enterprise projects. :-)

Until you definitively define "better" in terms of specific project requirements and personnel, you are shooting at an ever moving target that will always slip out of your debating cross-hairs. :-)

Me? I like assembly. FORTRAN is for woosies! lol

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.

User avatar
eiver
Level 5
Level 5
Posts: 566
Joined: Fri Jan 23, 2009 5:51 am

Re: C# vs. others

Post by eiver »

Ok. Lets move to an example then. Just a quick search returned this discussion: http://stackoverflow.com/questions/6864 ... difference
Please do not limit yourself to just reading it. Perform the tests yourself and post the results. (There is also a number of useful comments below the initial post).

Even C compiler (gcc for example) uses a lot of optimization techniques. Most programmers aren't even aware of this automation. You can do the same for C#. So theoretically all performance arguments come down to: how well the compiler can optimize the code. I am sure that you will be able to post an example where C outperforms C# as well as the other way around.

We all know, that a well written code will work better. So lets focus our discussion on how easy it is to write good code in C and in C#. How easy it is to introduce bugs in each. I could write so many advantages of C# over C in this matter, that the post I write would become too long. Instead lets focus on one feature at a time, discuss it and after discussion is finished we can move to the next one.

For the first feature I choose memory management and buffer overflow protection, because a buffer overflow is the most frequent reason for security holes and bugs in software. I hope this discussion will be quick, because there is not much to talk about. In C you can introduce a buffer overflow easily. Memory leaks are also easily created - a programmer just needs to forget about releasing the memory. In C# buffer overflows and memory leaks simply do not exist. C is just horrible in that regard and if you have millions of lines of code you simply cannot check everything yourself by hand.

User avatar
markfiend
Level 4
Level 4
Posts: 310
Joined: Wed Apr 15, 2009 2:56 pm
Location: Leeds, UK

Re: C# vs. others

Post by markfiend »

Omnia mutantur, nihil interit.

deleted

Re: C# vs. others

Post by deleted »

I'll chime in as a developer.
I've been a developing "enterprise" applications (whatever that's supposed to mean) for about 20 years. I've used C, C++, Java, Flex, Pearl, JavaScript, SAS, SQL, VB, (you get the picture).
Do I rival Knuth? No, I have a good dose of humility. I think Fred said it best when you choose the right tool for the right job. I'll go a step further. For "enterprise" applications (ie, ones that have long term support and are iteratively modified), the "best" language is not the ones that produces "fastest" runtimes (20 years ago that was important) or the "easiest" to use. You'll want to choose the one that's easiest to write maintainable code.
The program is only as good as it's author. I've written slow code in C, I've written fast code in VB. (I've written bad code in all languages).
But it always comes down to being able to pick up where I left off and how much of an application ripple it will cause if I modify the code.
Some languages, by their nature, help in one respect or other.

http://www.youtube.com/watch?v=qOajmNKsb5Q

-Hinto

User avatar
eiver
Level 5
Level 5
Posts: 566
Joined: Fri Jan 23, 2009 5:51 am

Re: C# vs. others

Post by eiver »

The so called "enterprise" applications are maybe the most prominent benchmark, because their development can be rated using a single value - price. But open source applications follow the same rules in principle - only usually money is replaced by some other resource like time. It is only worth to use C if the programmer can do a better job than C# compiler and still one must take into account the cost. How many hours do you need to make sure your code will never leak memory or cause a buffer overflow? The C# compiler can do it in a matter of seconds. You must be aware that every optimization process in software development follows the Pareto principle, so writing perfect code in C is impossibly expensive.

One does not need to have much work experience to realize how horrible development in C is. Even a small team project at school will teach you, that just dividing the code into functions is not enough to collaborate efficiently even in a small two-person team. That is why I was quite surprised that this discussion ended up being C vs C# or more generally C vs any other high-level language. I was expecting C# vs Java or C# vs Python.

deleted

Re: C# vs. others

Post by deleted »

In C you get consistency through convention. When you open a group (1 or more) up to C, the rules the need to be laid out so you can "support" each others coding style.. That is, if you have a huge amount of #define in some header file, you need to make folks aware of it otherwise you can't step a debugger through a #define and you can define TRUE=0 and FALSE=1. That being said, I've done some very readable and maintainable code with C++. One the features I really liked was operator overloading. I overloaded the [] (array operator) and the () (casting operator) to go to/from PLC bits. If I wanted to see if a particular bit was "on" I just used something like
if(foo[2] == ON) {
...
}

But back to memory leaks. That one was supposed to be the silver bullet for Java... It uses reference counting, etc, and it "knows" when to free memory. But any non-trivial app (ie, enterprise) needs to be aware of dangling references, etc. (not to mention any CORBA/native method calls). Over the years, Java has gotten better (I'm sure other reference counting languages have too) but it's not the silver bullet.
Additionally any "win" in garbage collection (say over C) is lost with the garbage collector. It has to run sometime or you'll run out of heap. Then that opens a whole new can of worms like how often should it run? should it run on it's own thread?, etc.

That being said, I do think a place where Java (or maybe C#) could "win" (instead of GC) is the Just In Time compiler. Since C/C++ has a static optimizer and Java has a JIT, Java can come close to matching some of the runtime benchmarks.

I still go back to maintainability being the rule of thumb. I've seen too many "easy" languages turn into spaghetti code and I've seen a 500 if/else block in C.

-Hinto

User avatar
DrHu
Level 17
Level 17
Posts: 7525
Joined: Wed Jun 17, 2009 8:20 pm

Re: C# vs. others

Post by DrHu »

http://www.fogcreek.com/

Maintainability should be the rule of thumb, I am just not sure how well it is practiced
--I think you will only know, if you listen to the maintenance programmers your organization may have available to them; if not then it's a guess as to the maintainability for a particular project or even programming language choice
http://www.joelonsoftware.com/articles/ ... 00069.html
http://www.joelonsoftware.com/uibook/ch ... 00057.html

Of course no-one wants to do maintenance coding, even though it is by far the best programmer training available to anyone..
--and that is why projects and programming language choices are often and in the main unmaintained, except to the end of a specific project, then all bets are off

Anyway about that Mono + C# thing (choice), for the fans: there is always gtk-sharp2

deleted

Re: C# vs. others

Post by deleted »

Maintenance programmers? ;) what's that? I work for the world's largest privately held software company and even we don't have that?
Here, we support what we write as well as release version-ed software (4.0, 4.1, 4.2, 5.0). I'd hate to re-write every release, we'd never get any new releases out the door.

User avatar
Kaye
Level 5
Level 5
Posts: 933
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: C# vs. others

Post by Kaye »

eiver wrote:One does not need to have much work experience to realize how horrible development in C is. Even a small team project at school will teach you, that just dividing the code into functions is not enough to collaborate efficiently even in a small two-person team. That is why I was quite surprised that this discussion ended up being C vs C# or more generally C vs any other high-level language. I was expecting C# vs Java or C# vs Python.
Seriously? It's becoming obvious that you just don't have the ability to code in anything other than C#! As a competent programmer, I don't find coding in C horrible at all. I have no problems with memory leaks or buffer overflows. I'd be willing to bet my code is significantly cleaner and more maintainable than most C# code as well.

Also, the Pareto principle has nothing to do with writing "perfect code," it has to do with bugs and other errors that introduce unforeseen problems into your software. C# is just as prone to the Pareto principle as C as both are heavily optimized. Do not think that simply because C# is higher level means that its compiler is better at optimizing - the opposite is most likely true.

I am done responding to this thread. It has become extremely clear that you are nothing more than a C# fanboy. There is no argument to be had as far as C# vs. Java - they are all but identical in each and every way. Every language has its place, but C# is nothing more than a copy of Java with no meaningful applications that can't be handled by another (more efficient) language. Sorry, this could've been a meaningful debate.

Ps. Fred, thanks as always :)
"In somnis veritas"
Antivirus or defragging?
Image

User avatar
DrHu
Level 17
Level 17
Posts: 7525
Joined: Wed Jun 17, 2009 8:20 pm

Re: C# vs. others

Post by DrHu »

hinto wrote:Maintenance programmers? ;) what's that? I work for the world's largest privately held software company and even we don't have that?
Here, we support what we write as well as release version-ed software (4.0, 4.1, 4.2, 5.0). I'd hate to re-write every release, we'd never get any new releases out the door.
OK, bug fixing then, instead of calling it maintenance
--I just happen to like mainframe terminology, and don't see the need to change just to seem more hip; I am not a jargon junkie.

..I'd hate to re-write every release..
That's why I still like APL..
--or you could say the same for an assembler, although it is not as bad as all that..

deleted

Re: C# vs. others

Post by deleted »

Using languages like APL is great. However, 75% of stuff we do is write a language like APL. That is, we sit between the high-level language and the bare metal. That's done in C. 15% of the stuff we do is use our language to write statistical analyses. 10% of the stuff we do is write client/server applications using any tool/language du jour. (as required by customers).
Maintainability is key. Choosing the right tool for the right job is key. Any "core competency" code should be implemented with the code that provides the easiest code base to maintain (and of course be supported on the platforms you are targeting).
-H

Post Reply

Return to “Open chat”