Why C is terrible, and Java/C# are Great

Page 3 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Crusty

Lifer
Sep 30, 2001
12,684
2
81
IDK, he seems somewhat overly attached to C over C++. The need for context should be present in file names, class names, and namespaces, not in function names IMO. So what if two classes have a "connect" function. So long as that function is in a logic spot, I don't see the issue.

Heck, he attacks the "new" keyword. Seriously, whats wrong with new? It is the best way to do automatic OOP.

He's not really attacking it, he's just stating that for what he does C works and it works really well. I agree that we're getting to the point now where if you really need control over the system you'll use C and otherwise there would be a better alternative than C++.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I just came across a link to a post by Linus where he talks about C, C++ and those 'other' languages. I think he's pretty spot on in regards to the topic.

http://www.realworldtech.com/forums/index.cfm?action=detail&id=110618&threadid=110549&roomid=2

Meh, the problem with that guy is people started telling him how smart he was at a really young age. Well he is smart, but a pretty significant amount of brainpower went into the evolution of C++ over the years, not to mention a millenia or two of real-world production experience; something that, as far as I know, Linus has never been successfully exposed to.

His comments about syntactic fluff just about anyone can agree with (and in light of the ISO standards process, perhaps lament), but all that stuff about the burdensome "context" of C++ as opposed to the elegantly focused and feathery-light context-free nature of C are just him, once again, puffing up his own biases into principles of nature.

Well-designed C++ is self-documenting with regards to context, because the context is the behavior and state of the entities the code is describing and simulating. Does it really cause him that much confusion to encounter ten versions of String.Append() taking various types as arguments? I guess he's seen a lot of crappy C++. The idea that C is somehow less "spread out" than C++ is pretty silly, actually. I've worked on big legacy C systems written by thousands of people over decades. I'm pretty certain Linus has never had to do that.
 

EricMartello

Senior member
Apr 17, 2003
910
0
0
From another thread...

Lets discuss this.

1. What is it about C syntax that is arcane, and more importantly, what does C# and/or Java do to improve it?
2. What are the inherent advantages of the runtime, beyond memory management? (after all, there are garbage collectors for C)
3. Whatever else this discussion spirals into...

It's amazing that this went 3 pages without turning into a flamefest. I'm not going to be the catalyst here...but I will say this:

1) C syntax is not "arcane". Modern languages like C#, Java and scripting languages like PHP all follow a C-inspired format. You will notice a lot of similarities and this is not an accident - it's there to reduce the learning curve. If you know C you can feel your way around most of the new languages and learn them without help.

What I like about C is that it is procedural, meaning it executes from the top down. It's not object oriented like C++ and most modern languages. While many will say that it is easier to manage a large project in C++, especially when dealing with multiple programmers, I believe that can be handled by the IDE. C does have a speed advantage over C++, although with compiler optimizations it may not be a whole lot.

2) Managed languages are McProgrammer languages. They dumb down programming to a point where some halfwit from DeVry can botch together an application good enough to impress some clueless hiring manager, and there you have your "McDeveloper". You'll see a lot of these folks trolling sites like freelancer, willing to work for peanuts.

I'm not saying that each new application should be starting from scratch, but if you want a good RAD you should check out something like Delphi. It's the best kept secret - performance that rivals C with the development speed of something like C# or VB...best of all, the apps it produces do not rely on clunky DLLs or some runtime that must be preinstalled.

3) There is a new bacon-flavored syrup. You can add a few dashes to a cup of coffee for that extra bacon zing.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
I'm not saying that each new application should be starting from scratch, but if you want a good RAD you should check out something like Delphi. It's the best kept secret - performance that rivals C with the development speed of something like C# or VB...best of all, the apps it produces do not rely on clunky DLLs or some runtime that must be preinstalled.
Sounds great. I will check that out.

3) There is a new bacon-flavored syrup. You can add a few dashes to a cup of coffee for that extra bacon zing.

o_O
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
2) Managed languages are McProgrammer languages. They dumb down programming to a point where some halfwit from DeVry can botch together an application good enough to impress some clueless hiring manager, and there you have your "McDeveloper".

It seems to me you confuse a higher level of abstraction with "dumbing things down". I agree that these languages make programming more accessible to a wider audience, however I don't feel that it has been dumbed down. If a company isn't able to filter out these "McDevelopers" from people who actually know what they're doing, then it's most likely not a great environment to work in anyways.

It's important for any good developer to have a good understanding of the entire system they work in, which includes assembly, C/C++, and any higher level runtimes that may be used. This doesn't mean you need to be an assembly or C master to write a Java app, but it's important to at least know how all the pieces come together to be effective.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
It seems to me you confuse a higher level of abstraction with "dumbing things down". I agree that these languages make programming more accessible to a wider audience, however I don't feel that it has been dumbed down. If a company isn't able to filter out these "McDevelopers" from people who actually know what they're doing, then it's most likely not a great environment to work in anyways.

It's important for any good developer to have a good understanding of the entire system they work in, which includes assembly, C/C++, and any higher level runtimes that may be used. This doesn't mean you need to be an assembly or C master to write a Java app, but it's important to at least know how all the pieces come together to be effective.

Abstraction is good; but it is always useful to understand the layer that supports what you are coding/designing in.

One issue with any abstraction (language) is that the schools will jump on it as the next hot area and start pumping out people that may know this area; but have no understanding how to dig into the support layer. These types, I believe is what you call a McDeveloper.
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
Abstraction is good; but it is always useful to understand the layer that supports what you are coding/designing in.

One issue with any abstraction (language) is that the schools will jump on it as the next hot area and start pumping out people that may know this area; but have no understanding how to dig into the support layer. These types, I believe is what you call a McDeveloper.

I agree, but it seems as if your stance is that if abstraction enables bad developers to write bad code, then abstraction itself is bad. Since these languages make programming as a whole more accessible, you end up with more less capable people taking a shot at it. I'm sure most people who write bad Java apps would write even worse C apps (given similar experience with both platforms), and this has nothing to do with the language itself. Abstraction is a strong tool for all developers, and shouldn't be invalidated by those who misuse this power.
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
ASM will always exist and so will C unless things really change. Someone has to write the low level code to run all these higher languages. Personally I don't care what people use in the pc world. Where I get concerned is when people try to approach the embedded or single purpose mcu market with things like only a background in java. I can't tell you the number of times people have asked why their program isn't working correctly because they are trying to write code in a high level language like they would on a pc but they are developing for an embedded product. They are nowhere near the same and if someone isn't willing to learn the hardware thoroughly you cannot leave it up to the compiler to do everything for you.

Compilers are good but not perfect and every embedded chip has quirks that someone with only a high level language background will fight with while trying to write a program. Some might say that the compiler could be adapted to overcome those quirks for each device but that isn't going to happen due to the nature of the platform. Some things only appear in very specific circumstances, things a compiler cannot predict. C has remained in use because it is the right balance between low and high level languages.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Managed languages are McProgrammer languages. They dumb down programming to a point where some halfwit from DeVry can botch together an application good enough to impress some clueless hiring manager, and there you have your "McDeveloper". You'll see a lot of these folks trolling sites like freelancer, willing to work for peanuts.

Managed languages don't change any of the essential challenges of creating software. All they do is make the non-essential challenges less challenging. What's the major difference between C++ and C# for a working programmer? Object life cycle management. You could argue RTTI and reflection are just as significant, but I think managed memory and object life cycles hits the new C# programmer earlier than anything else. Do you honestly think you can't engineer an elegant solution to a difficult problem if you're not manually managing object life cycles? If that's not it, then please describe what feature of programming in C or C++ makes you write smarter programs than a person working in C#.
 

jsedlak

Senior member
Mar 2, 2008
278
0
71
1. I can't, for the life of me, see how C is arcane and C#/Java is so much better. They use essentially the same style of syntax. Heck, the standards committees have done a lot of work to ensure this (seriously). Just the other day I was watching a video about the upcoming C++0x standard, and one of the big issues they were discussing is the fact that volatile does different things in Java and C/C++. They can't change it because of its widespread usage in C/C++.

The syntax of very advanced C/C++ code is confusing to even the most experienced developers. As a language, C++ has a lot more quirks in its syntax than C#. The spec for C# was made approachable for C/C++/Java developers, but it has done away with needless quirks that no one can remember and rather has put focus on the syntactical sugar.

2. Really, platform independence and a large built in library are the two biggest advantages of having a runtime. Other then that... not much.

These are big advantages that shouldn't be brushed aside in such a way. Since big projects can take a very long to compile, being able to "compile once, run everywhere" dramatically affects the efficiency of large project development cycles.

The most obvious benefit (for me) to C# and .NET is that it simply isn't C++. It is extremely powerful and yet easy to learn. You can't say the same of C/C++.

3. I would argue that platform independence is a moot issue. So what if you have to recompile your software to run it on the ARM architecture, most people don't develop for both anyways.

It is more than just platform independence. It is the notion of not worrying about platform specific code. I will admit that it isn't a perfect world (the difference between the full framework and the compact framework is still substantial), it is fairly close.

It can be the difference between having two completely different teams of coders. This has a large impact on the overall cost of a multi-platform project. So to say that such a thing is a worthless point is naive.

Look at the cost of porting a game from the Xbox 360 to the other platforms or vice versa. If your developers do not have the necessary knowledge base, the cost of the product increases substantially. This is especially true in game development where each system has its own set of specific hardware benefits and problems and is demonstrated by the rather slow uptake of PS3 games in the beginning of its life cycle.

A runtime also introduces tons of issues, such as, getting to predict which version of the runtime platform x has. And if it doesn't have the correct version, happily installing the 25mb+ file for your 200kb program (Not such a big deal now-a-days, it was a big issue for me when I was younger and weighing the advantages/disadvantages of VB6 or C++). Or worse, the platform having a non-standard compliant runtime.

A moot point in the age of broadband, and more so in the future. The beautiful thing about .NET is that it is a completely stable platform and such issues are few and far between. The only problem is deciding against which version to code. And even then the difference between 2.0 and 4.0 is fairly small for most developers.

Heck, the development of the runtime is a huge issue in-and of itself. Look at how long it took Linux to get C# support (through mono). And it still isn't 100% compatible, you still often have to recompile with mono to get the program to work in a linux environment because the kernel doesn't support reading PE files (Where is the benefit if the user has to recompile anyways?)

There is a large up front cost of having to develop the platform, but this can be considered a one off problem. Updates to the platform should not require major reworking. To ignore the fact that every other language has similar issues is silly.
 

Train

Lifer
Jun 22, 2000
13,586
82
91
www.bing.com
Abstraction is good; but it is always useful to understand the layer that supports what you are coding/designing in.

One issue with any abstraction (language) is that the schools will jump on it as the next hot area and start pumping out people that may know this area; but have no understanding how to dig into the support layer. These types, I believe is what you call a McDeveloper.

I don't think lowering the barrier to entry is ever bad for an industry.
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
Wow, are you telling me that nobody had to ever deal with the Assembly-guy? The guy who claims he can do everything, every project, every piece of code, every interface, in assembly and all higher languages are junk?

I assumed that with at least 5 years in the industry, everyone had run into the proverbial Assembly-guy with great irritation.

I am sure the Assembly guy gets a lot of crap from the punch-card guy, and he gets crap from the Antikythera mechanism-guy...
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Wow, are you telling me that nobody had to ever deal with the Assembly-guy? The guy who claims he can do everything, every project, every piece of code, every interface, in assembly and all higher languages are junk?

I assumed that with at least 5 years in the industry, everyone had run into the proverbial Assembly-guy with great irritation.

I am sure the Assembly guy gets a lot of crap from the punch-card guy, and he gets crap from the Antikythera mechanism-guy...

Haha. I think you missed toggle-switch guy, and plug-board guy, and wooden peg guy.
 

jsedlak

Senior member
Mar 2, 2008
278
0
71
Wow, are you telling me that nobody had to ever deal with the Assembly-guy? The guy who claims he can do everything, every project, every piece of code, every interface, in assembly and all higher languages are junk?

I assumed that with at least 5 years in the industry, everyone had run into the proverbial Assembly-guy with great irritation.

I am sure the Assembly guy gets a lot of crap from the punch-card guy, and he gets crap from the Antikythera mechanism-guy...

When I was first introduced to assembly, I thought it was amazing. I have idealized it into the moment that Neo sees the matrix for what it is for the first time. Certainly it is a lot of power and possibility, and with the ability to extend some of the assembly "languages" (Y86 for instance) the power only becomes greater.

But then I realized the effort it took just to write a calculator. Yuck!
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,695
4,658
75
That's one really nice thing about runtime-based languages: In many cases you can choose to write in a language appropriate for the task. For instance, if I want to manipulate lots of strings, I can use JRuby or Iron Ruby.

Where that seems to break down is at the assembly level. (Not .NET assembly; x86 assembly.) The problem is that runtimes are so hardware-independent that it's hard to interface with specific hardware when you want to. That's why even the terminology is confusing.

Sometimes you (or at least I) really do need low-level assembly for small portions of code. For instance, I'm working on this program for PrimeGrid (see my sig) to quickly find prime factors of numbers. It's mostly written in C, with some assembly and/or intrinsic sections.

A smart compiler can help avoid writing assembly. There's one small section where I have to set each of a few numbers N to P-N. GCC 4.3 turns that into SSE2 code. Versions of GCC before 4.1 make my code much slower, probably because they don't do things like this. I also use intrinsics in places, and if I use too many SSE2 registers, even this smart version of GCC will start thrashing them to RAM.

But there are places where real human ingenuity is required for maximum speed. About half the inner loop involves testing whether X, right-shifted until it's odd, is less than N. How do I do that in SSE2, when there's no trailing-zero-count instruction? Well, I get the first 1 with (X&-X), then I multiply N by that value, and finally I compare the result to X. This is something no compiler could ever come up with. It doesn't even work in all cases and I have to track those edge cases. But it makes the code a whole lot faster.

If I had to use only C# or Java to write that code, even with major algorithm changes, I'm sure it wouldn't be much more than half as fast as it is now.
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
It seems to me you're best off realizing that there isn't one "Greatest Language EVER", because everything is about context. To go from different extremes, Assembly is great if you want/need extremely fine control over what instructions are being executed. On the flip side, Java/C# (or even higher level languages such as Python) are great if you have plenty of speed and need to do something quickly an easily.

I would always pick the highest level language that I know and that will do the job sufficiently. Over time you will most definitely see that average point move to higher and higher levels of abstraction.
 

scootermaster

Platinum Member
Nov 29, 2005
2,411
0
0
It's amazing that this went 3 pages without turning into a flamefest. I'm not going to be the catalyst here...but I will say this:

2) Managed languages are McProgrammer languages. They dumb down programming to a point where some halfwit from DeVry can botch together an application good enough to impress some clueless hiring manager, and there you have your "McDeveloper". You'll see a lot of these folks trolling sites like freelancer, willing to work for peanuts.

I'm not saying that each new application should be starting from scratch, but if you want a good RAD you should check out something like Delphi. It's the best kept secret - performance that rivals C with the development speed of something like C# or VB...best of all, the apps it produces do not rely on clunky DLLs or some runtime that must be preinstalled.

This is the sort of thing I was talking about earlier when these debates come up. You get all of this misplaced...bitterness? Jealousy? Anger? I mean, it's human nature, so there's no point in being surprised by it, but it's just kinda weird. You have the web programmers looking down on the IT guys, the "codemonkeys" looking down on the web programmers, the the software engineers looking down on the codemonkeys, the old-timers looking down on the software engineers, and the techie-nerd-fanboys (i.e. people with serious knowledge outside the "industry") looking down on the old timers. And then, of course, you have the academics which are in the weird position of being perfectly symmetric; they look down on everyone while simultaneously are looked down upon by everyone.

It's just predictable and a bit obvious. If you want to try and convince me that that sort of "you do this = you're a McProgrammer" doesn't smack of bitterness and "I spent X years doing this the hard way and now some twit with a $30 gift card to Borders can do it better than me"-ness, go right ahead but you're going to have a hard time.

But that whole line of thinking is sort of missing the point. No one needs me to tell them that, yes, modern tools make things easier and faster. Modern tools like, oh, programming languages. And the more modern they get, the easier and faster it will be to produce "something" with them. And if you have dumb managers like appreciate crap code, then blame the manager, not the programmer [regardless of whether or not there's a "Mc" in front of it or not]

The fact is that if your skill set is such that "McProgrammers" threaten you, you need to get another skill set. That's your problem, not C#'s, or whatever.

There's nothing intrinsically wrong with any programming language (except Fortran, which was sent from hell to destroy us all).

Anyway, like I said, I have no particular horse in this debate, I just find the psychology behind people's opinions on this debate more interesting than the debate itself. It's a neat little case study on tech people's mindstate.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
This is the sort of thing I was talking about earlier when these debates come up. You get all of this misplaced...bitterness? Jealousy? Anger? I mean, it's human nature, so there's no point in being surprised by it, but it's just kinda weird.

Eric often sounds like that. I'm half-convinced he doesn't mean it. It might even be a sign of affection.
 
Last edited:

EricMartello

Senior member
Apr 17, 2003
910
0
0
Managed languages don't change any of the essential challenges of creating software. All they do is make the non-essential challenges less challenging. What's the major difference between C++ and C# for a working programmer? Object life cycle management...

What's the ratio of McDeveloper to real programmer? It's not 1:1....if I had to estimate I'd say something like 5:1 or worse. The bar is lower, and a lot of what a real programmer knows, a McDeveloper does not.

To put it another way, someone who is good at RockBand is not necessarily going to be a good musician...even if they both understand the fundamentals of the tasks involved, the one playing RockBand never gets a true feel for making music. You could also say someone who is really good at Grand Turismo will not necessarily be a good race car driver (although at least one guy made the cross-over from gamer to real racer - 99% do not and are in fact mediocre drivers).

Managed languages make you lazy, and this laziness tends to breed complacency and sloppiness. This is easily evidenced by the fact that many modern programs are needlessly bloated...pure reliance on managed langs shifts the focus from "how can I make this better" to "what's the fastest way I can get this done". I appreciate and respect quality and the person who takes the time and makes the effort to really understand their craft - whatever it may be.

This is the sort of thing I was talking about earlier when these debates come up. You get all of this misplaced...bitterness? Jealousy? Anger? I mean, it's human nature, so there's no point in being surprised by it, but it's just kinda weird. You have the web programmers looking down on the IT guys, the "codemonkeys" looking down on the web programmers, the the software engineers looking down on the codemonkeys...

No, it's disgust and disdain. McProgrammers do not have a real understanding of programming. They have a working knowledge, which is enough to produce a program...but ask them how to tune it, optimize it, make it more efficient, cut down the executable size...they're mostly clueless. This isn't an issue with the role they play in the grand scheme of things, it's simply that their existence diminishes the overall quality of software being produced.

The "good enough" mentality is wasteful and with each generation of programmers who adopt this "eh, I have a quad core i7...it runs fast...no need to waste time optimizing this program" the general bloating effect is amplified. Then there is also the complete misuse of a platform, when a platform is being used to support things it was never originally intended to...Adobe Flash comes to mind...perfect example of a McPlatform gone awry.
 

scootermaster

Platinum Member
Nov 29, 2005
2,411
0
0
The "good enough" mentality is wasteful and with each generation of programmers who adopt this "eh, I have a quad core i7...it runs fast...no need to waste time optimizing this program" the general bloating effect is amplified. Then there is also the complete misuse of a platform, when a platform is being used to support things it was never originally intended to...Adobe Flash comes to mind...perfect example of a McPlatform gone awry.

I might argue that this has less to do with programming language selection, and more to do with hardware. Or at least, that hardware was the catalyst for this back in the day. All I know, is that in my lifetime, the biggest inflection point I've seen was when hard disks became "large" (relative to the size of programs) and cheap/viable. There was this stasis that'd been reached where developers attempted to get literally every bit out of a program (remember the late 80's, early 90's graphic "demo" scene?). I attribute this to floppy disks. Programming power increased much more than floppy disk capacity. If you consider just 3.5 disks, you get period of years where processing power goes from, say, a 286 to a 486/Dx, but floppy disk size is fixed at 1.44meg. That means the programmers just have to be smarter. So you saw people do pretty darn amazing things with those 1.44 megs.

Once hard drives became reasonable size, you had these 20, 30, whatever meg hard drives that just appeared in everyone's computer, but yet processing power stayed somewhat constant (it's obviously always increasing, but over a small enough time line it appears somewhat stable). So developers were like "WOW! I have all this room!" and instead of bitwise tuning their programs, they just let them grow. Once the last computer game shipped on either 12 floppy disks or 1 CD rom, it was pretty much all game over from there. We'd reached the point that pretty much no matter how "big" your code was, it was going to be small enough to fit on a CD, zip disk, hard drive etc (even if it was so large and bloated the processor couldn't really handle it). So the days of the developer having to make tight, compact and efficient code were over.

Now, we're more limited by processing power, but I still feel the big change was in the early 90's, when source distribution became easier (because of CD roms and larger hard drives). After that, there was no reason to really worry about how big (and by extension, bloated) your code was.

Edit: And, I guess the other thing I forgot to mention is that the programming language during this period was relatively stable.
 
Last edited:

dinkumthinkum

Senior member
Jul 3, 2008
203
0
0
Bloat doesn't just come from programmer laziness (though I know plenty of it does). There is a trade-off: code that is optimized for running time tends to be less space-efficient. This can apply to algorithms (I think the classic example is dynamic programming techniques) or to the output of compilers.

For example, when a modern compiler performs optimizations for speed, it tends to cause the resulting binary to expand in size by a fairly large amount. The following optimizations all increase bloat: loop unrolling, function inlining, type specialization, and cache-aware data layout all can contribute.

Since space is cheap, as you point out, most people are willing to live with this.

An anecdotal data point: compiling my current work-in-progress (an OS kernel) with -O2 instead of -O0 adds about 200kbytes to the final size.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Managed languages make you lazy, and this laziness tends to breed complacency and sloppiness. This is easily evidenced by the fact that many modern programs are needlessly bloated...pure reliance on managed langs shifts the focus from "how can I make this better" to "what's the fastest way I can get this done". I appreciate and respect quality and the person who takes the time and makes the effort to really understand their craft - whatever it may be

I'm sorry man, but that's just wrong. Not having to manage memory manually makes you lazy? The system I'm currently working on consists of a Silverlight front end with about 350 classes and 200 controls in it, a web services tier with over 150 endpoints, two SQL server databases, a content repository with 8 terabytes of digital music files, and a data transformation layer that moves around 10 GB/day to/from various partners, most of it transformed in one way or another as it passes our door. It's all written in C#, none of it is simple, and none of the people who work on it are lazy. Not one single aspect of this system would be made better in any meaningful way by writing it in an unmanaged language, and yet I guess according to you we should do that, and expand the investment in the project from 6 man years to 8-10 man years.

That is a seriously flawed view of our business. I'm inclined to short the stock of any company you work for.
 

EricMartello

Senior member
Apr 17, 2003
910
0
0
I might argue that this has less to do with programming language selection, and more to do with hardware. Or at least, that hardware was the catalyst for this back in the day. All I know, is that in my lifetime, the biggest inflection point I've seen was when hard disks became "large" (relative to the size of programs) and cheap/viable.

No doubt that this is a major contributing factor but it's not really a justification for sloppy coding. Now that data storage is bountiful, we can use this space but how we use it really determines the general direction programs go.

My point is that most of the day to day programs we use do not need to be as large as they are to provide the functionality they provide. I love to point out uTorrent as an example of a modern program coded efficiently and intelligently. It provides all of the functionality of a more bloated program like Azureus (done in java) and yet its one executable file about 800KB in size, while Azureus is bloated pig by comparison.

If there is a reason to use the extra space, use it...but filling it up simply because it is there is still a bad practice.

Since space is cheap, as you point out, most people are willing to live with this.

An anecdotal data point: compiling my current work-in-progress (an OS kernel) with -O2 instead of -O0 adds about 200kbytes to the final size.

I have nothing against increasing the size of a program IF it provides tangible benefits...but the linux kernel is what, about 25 MB? An increase in size of 200KB is less than 1%...if it provides more than 1% increase in performance then wouldn't it be a worthwhile tradeoff? On the otherhand, if said "optimization" caused the file to grow by 50% it wouldn't be such a great deal.

I'm sorry man, but that's just wrong. Not having to manage memory manually makes you lazy? The system I'm currently working on consists of a Silverlight front end with about 350 classes and 200 controls in it, a web services tier with over 150 endpoints, two SQL server databases, a content repository with 8 terabytes of digital music files, and a data transformation layer that moves around 10 GB/day to/from various partners, most of it transformed in one way or another as it passes our door. It's all written in C#, none of it is simple, and none of the people who work on it are lazy. Not one single aspect of this system would be made better in any meaningful way by writing it in an unmanaged language, and yet I guess according to you we should do that, and expand the investment in the project from 6 man years to 8-10 man years.

That is a seriously flawed view of our business. I'm inclined to short the stock of any company you work for.

That which you described above is all well and good, but if you had the right team of coders doing the same thing in C or C++ you could probably get the same level of performance on less hardware.

A real-world example of a game-changer due to efficient coding is the Qmail MTA (SMTP Server). Before Qmail most hosts were using sendmail to process and receive email between servers. Sendmail was a clunky, buggy and inefficient MTA that did its job slowly and ate resources like they were made from bacon.

Along came the somewhat eccentric DJ Bernstein who gave us Qmail, and suddenly a mail server struggling to do 100,000 messages per hour at 20+ load could doe 1,000,000 per hour and the load dropped below 5. He also made tinyDNS which trumps BIND in performance and security, but due to it being user-unfriendly it never really caught on. What I found very amusing is the BIND developers trying to play-down tinyDNS because it lacked features like DNSSEC, which it does not need, because unlike BIND it never had the security holes that allowed for cache poisoning or DoS attacks. So yeah, just because BIND is the most widely deployed DNS server does not make it the best...although Qmail is still the most widely used MTA hands down.

So we can liken your above example of using C# to Sendmail, and mine is obviously C/C++ => Qmail. You come off as being very complacent, like you are sold on the whole idea of C# being "good enough" whereas my idea is "how can we make this better/faster/more efficient".
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Markbnj said:
... Not having to manage memory manually makes you lazy? The system I'm currently working on [degibson summary] is huge, complicated, and obviously not the product of lazy coders. [/degibson summary] ...

That which you described above is all well and good, but if you had the right team of coders doing the same thing in C or C++ you could probably get the same level of performance on less hardware.

...

I want to mention several things about this debate:

1. Obviously, it is entirely possible to make high-throughput amazing massive-scale applications in managed languages.

2. EricMartello's point about right coders + time + C = less hardware, is fundamentally, correct. It is not clear that doing so would be cost-effective, however, as the number of 'right coders' and amount of 'time' could be very, very substantial.

3. It is possible to write garbage, lazy code in any language. It is possible to write better code in C# than in C++.

4. One argument is that managed languages encourage programmers to be lazy (in a bad way -- there is definitely such a thing as good laziness). I'm actually inclined to agree with that, but there are many forces designed to prevent programmers from being lazy (in a bad way). E.g., good programmers themselves eschew bad laziness. Good managers encourage their programmers not to be lazy. Good programming practices, infrastructure, and colleagues prevent bad-laziness. Without these things, by comparison, the pro-laziness contribution of the language is small.

5. What I really want to know, e.g., from Markbnj, is why is your massive system in C# in the first place? What motivated that language? Clearly you guys have the skill to deal with the memory management issues -- the other issues you mentioned are way more complicated.
 

dinkumthinkum

Senior member
Jul 3, 2008
203
0
0
It's about a 10&#37; increase in my case, and I'm operating under fairly low memory requirements, so it could be an issue.

I've seen more aggressive compilers bloat the size of the output of other programs by 50% or more, but the performance was worth it.

Anyway, I prefer my laziness to be in my programming language (e.g. Haskell). But I will point out that laziness is a major driver of innovation. After all, if we weren't lazy, we would be doing our work manually, instead of writing programs to do it for us.