363
votes

This is definitely subjective, but I'd like to try to avoid it becoming argumentative. I think it could be an interesting question if people treat it appropriately.

The idea for this question came from the comment thread from my answer to the "What are five things you hate about your favorite language?" question. I contended that classes in C# should be sealed by default - I won't put my reasoning in the question, but I might write a fuller explanation as an answer to this question. I was surprised at the heat of the discussion in the comments (25 comments currently).

So, what contentious opinions do you hold? I'd rather avoid the kind of thing which ends up being pretty religious with relatively little basis (e.g. brace placing) but examples might include things like "unit testing isn't actually terribly helpful" or "public fields are okay really". The important thing (to me, anyway) is that you've got reasons behind your opinions.

Please present your opinion and reasoning - I would encourage people to vote for opinions which are well-argued and interesting, whether or not you happen to agree with them.

0

407 Answers 407

1
vote

There are only 2 kinds of people who use C (/C++): Those who don't know any other language, and those who are too lazy to learn a new one.

2
  • I worked with a guy who was doing C/C++ for 15 years, and flat out refused to learn anything else. He considered anything other than C/C++ to be a child's toy, which included any managed frameworks .NET or Java and any web related technology. Therefore the only thing he could program is Win32 desktop applications. And he made it very clear he's not going to learn anything new, and will be doing C/C++ to his retirement.
    – WebMatrix
    Apr 21, 2009 at 14:52
  • 1
    And those who feel C++ is still the best way despite knowing Java and C#.
    – luiscubal
    Jul 11, 2009 at 0:28
1
vote

"else" is harmful.

8
  • What do you propose as an alternative? Jun 5, 2009 at 19:27
  • A series of if()s, each fully enumerating the situation where it occurs. Else of course only implicitly states; the reader has to maintain state in his own head, and there's a pretty low limit before people are overwhelmed and start getting it wrong. Another way is to have if()s which set a state variable, and then switch on that state.
    – user82238
    Jun 6, 2009 at 7:44
  • Another issue here is reading code from top to bottom. Multiple elses, especially with a chunks of code of any size in them, require the reader to scoot up and down the code, matching elses to ifs. I find it immesureably better to have a purely linear flow of code.
    – user82238
    Jun 6, 2009 at 7:46
  • 1
    Consider --if(a) a = false; else print("x");-- and --if(a) a = false; if(!a) print("x");-- They are not the same thing. As for issues with understanding code, I believe proper indentation solves most of the problems.
    – luiscubal
    Jul 11, 2009 at 0:30
  • +1.. interesting point.. At university I was taught to -always- write an else statement explicitly to improve testability (an omitted else clause should be considered as executing a null statement in code path analysis), but I agree that for readability it can sometimes indeed be better to refactor. Jul 12, 2009 at 0:10
1
vote

That the Law of Demeter, considered in context of aggregation and composition, is an anti-pattern.

1
  • How can this be controversial when most of us didn't understand what you meant. :-)
    – Warren P
    Apr 1, 2010 at 0:11
1
vote

I am of the opinion that there are too many people making programming decisions that shouldn't be worried about implementation.

1
vote

You'll never use enough languages, simply because every language is the best fit for only a tiny class of problems, and it's far too difficult to mix languages.

Pet examples: Java should be used only when the spec is very well thought out (because of lots of interdependencies meaning refactoring hell) and when working with concrete concepts. Perl should only be used for text processing. C should only be used when speed trumps everything, including flexibility and security. Key-value pairs should be used for one-dimensional data, CSV for two-dimensional data, XML for hierarchical data, and a DB for anything more complex.

1
vote

I believe that the "Let's Rewrite The Past And Try To Fix That Bug Pretending Nothing Ever Worked" is a valuable debugging mantra in desperate situations:

https://stackoverflow.com/questions/978904/do-you-use-the-orwellian-past-rewriting-debugging-philosophy-closed

1
vote

Remove classes. Number of classes (methods of classes) in .NET Framework handles exception implicitly. It's difficult to work with a dumb person.

1
vote

Don't use keywords for basic types if the language has the actual type exposed. In C#, this would refer to bool (Boolean), int (Int32), float (Single), long (Int64). 'int', 'bool', etc are not actual parts of the language, but rather just 'shortcuts' or 'aliases' for the actual type. Don't use something that doesn't exist! And in my opinion, Int16, Int32, Int64, Boolean, etc makes a heck of a lot more sense then 'short', 'long', 'int'.

2
  • 4
    int, bool etc most certainly are part of the C# language. They're right there in the specification! They may not be part of the underlying platform, but they're definitely part of the C# language.
    – Jon Skeet
    Jul 29, 2009 at 5:22
  • I think platform is what I meant. * looks around * Thanks for the clarification! Jul 29, 2009 at 6:08
1
vote

When many new technologies appear on the scene I only learn enough about them to decide if I need them right now.

If not, I put them aside until the rough edges are knocked off by "early adopters" and then check back again every few months / years.

2
  • In what sense is this an controversial opinion?
    – Ikke
    Sep 9, 2009 at 7:25
  • @Ikke, Why? Surely this makes me an out of touch dinosaur, scared of change and clinging to out-dated and obsolete technologies? (I've lost count of how many projects I've worked on use new technologies because "they're cool" and will solve all our problems.)
    – Ash
    Sep 10, 2009 at 10:05
1
vote

Agile sucks.

1
vote

Jon Bentley's 'Programming Pearls' is no longer a useful tome.

http://tinyurl.com/nom56r

2
  • Interesting opinion. I guess on the details I agree, but in terms of overall attitude, I think we can learn from it. I think we programmers tend to run in channels, and Jon has an attitude of inventiveness and questioning accepted "wisdom". (Not to mention fun.) Oct 13, 2009 at 22:41
  • being extremely familair with C syntax carries-over to many languages. And anyone who thinks this is aimed at graduate students is off their rocker - I only know one person who read it in grad school. Almost everyone I know who has read it and/or owns a copy did so either before graduating college, or because they jumped to development from another field, or because they just wanted to.
    – warren
    Oct 23, 2009 at 4:20
1
vote

I think Java should have supported system-specific features via thin native library wrappers.

Phrased another way, I think Sun's determination to require that Java only support portable features was a big mistake from almost everyone's perspective.

A zillion years later, SWT came along and solved the basic problem of writing a portable native-widget UI, but by then Microsoft was forced to fork Java into C# and lots of C++ had been written that could otherwise have been done in civilized Java. Now the world runs on a blend of C#, VB, Java, C++, Ruby, Python and Perl. All the Java programs still look and act wierd except for the SWT ones.

If Java had come out with thin wrappers around native libraries, people could have written the SWT-equivalent entirely in Java, and we could have, as things evolved, made portable apparently-native apps in Java. I'm totally for portable applications, but it would have been better if that portability were achieved in an open market of middleware UI (and other feature) libraries, and not through simply reducing the user's menu to junk or faking the UI with Swing.

I suppose Sun thought that ISV's would suffer with Java's limitations and then all the world's new PC apps would magically run on Suns. Nice try. They ended up not getting the apps AND not having the language take off until we could use it for logic-only server back-end code.

If things had been done differently maybe the local application wouldn't be, well, dead.

1
vote

QA can be done well, over the long haul, without exploring all forms of testing

Lots of places seem to have an "approach", how "we do it". This seems to implicitly exclude other approaches.

This is a serious problem over the long term, because the primary function of QA is to file bugs -and- get them fixed.

You cannot do this well if you are not finding as many bugs as possible. When you exclude methodologies, for example, by being too black-box dependent, you start to ignore entire classes of discoverable coding errors. That means, by implication, you are making entire classes of coding errors unfixable, except when someone else stumbles on it.

The underlying problem often seems to be management + staff. Managers with this problem seem to have narrow thinking about the computer science and/or the value proposition of their team. They tend to create teams that reflect their approach, and a whitelist of testing methods.

I am not saying you can or should do everything all the time. Lets face it, some test methods are simply going to be a waste of time for a given product. And some methodologies are more useful at certain levels of product maturity. But what I think is missing is the ability of testing organizations to challenge themselves to learn new things, and apply that to their overall performance.

Here's a hypothetical conversation that would sum it up:

Me: You tested that startup script for 10 years, and you managed to learn NOTHING about shell scripts and how they work?!

Tester: Yes.

Me: Permissions?

Tester: The installer does that

Me: Platform, release-specific dependencies?

Tester: We file bugs for that

Me: Error handling?

Tester: when errors happen to customer support sends us some info.

Me: Okay...(starts thinking about writing post in stackoverflow...)

1
vote
  • Soon we are going to program in a world without databases.

  • AOP and dependency injection are the GOTO of the 21st century.

  • Building software is a social activity, not a technical one.

  • Joel has a blog.

1
vote

You only need 3 to 5 languages to do everything. C is a definite. Maybe assembly but you should know it and be able to use it. Maybe javascript and/or Java if you code for the web. A shell language like bash and one HLL, like Lisp, which might be useful. Anything else is a distraction.

1
vote

Apparently it is controversial that IDE's should check to see whether they can link up the code they create before wasting time compiling

But I'm of the opinion that I shouldn't compile a zillion lines of code only to realize that Windows has a lock on the file I'm trying to create because another programmer has some weird threading issue that requires him to Delay Unloading DLLs for 3 minutes after they aren't supposed to be used.

2
  • You're asking for a language with knowledge of platforms and implementation details. They don't work that way. Mar 15, 2010 at 19:33
  • No, I'm asking for an IDE with knowledge of platforms and implementation details. But thanks for the controversy! I didn't realize this question was finally deleted. Mar 15, 2010 at 21:33
1
vote

"XML and HTML are the "assembly language" of the web. Why still hack it?

It seems fairly obvious that very few developers these days learn/code in assembly language for reason that it's primitive and takes you far away from the problem you have to solve at high-level. So we invented high-level languages to encapsulates those level entities to boost our productivity thru the language elements that we can relate to more at higher level. Just like we can do more with a computer than just its constituent motherboard or CPU.

With the Web, it seems to me developers still are reading/writing and hacking HTML,CSS,XMl,schemas, etc.

I see these as the equivalent of "assembly language" of the Web or its substrates. Should we be done with it?. Sure, we need to hack it sometimes when things go wrong. But surely, that's an exception. I assert that we are replacing lower-level assembly language at machine level with its equivalent at Web-level.

2
  • That's like saying, Python is the assembly of Django, don't use it!
    – hasen
    Nov 13, 2009 at 21:27
  • 1
    You want to invent a new language that is at a higher level than XHTML? Dec 15, 2009 at 0:30
1
vote

Neither Visual Basic or C# trumps the other. They are pretty much the same, save some syntax and formatting.

1
  • 1
    Now... They weren't always so feature similar. So you have to fight what many of us learned once upon a time.
    – Jon Adams
    Nov 13, 2009 at 22:39
1
vote

I think we should move away from 'C'. Its too old!. But, the old dog is still barking louder!!

2
  • It is probably still one of the best languages to write an operating system in assuming (1) you are starting from scratch, (2) you want it to be fast but do not have time to write it in assembly, and (3) want to work on maintaining and editing operating systems written in C. Dec 15, 2009 at 0:25
  • One word: no. Oh wait, that were three words.
    – user142019
    Dec 20, 2010 at 14:46
1
vote

Associative Arrays / Hash Maps / Hash Tables (+whatever its called in your favourite language) are the best thing since sliced bread!

Sure, they provide fast lookup from key to value. But they also make it easy to construct structured data on the fly. In scripting languages its often the only (or at least most used) way to represent structured data.

IMHO they were a very important factor for the success of many scripting languages.

And even in C++ std::map and std::tr1::unordered_map helped me writing code faster.

1
  • This ain't controversial at all! (See the JSON vs. XML debate).
    – s4y
    Dec 18, 2010 at 21:00
1
vote

C++ is future killer language...

... of dynamic languages.

nobody owns it, has a growing set of features like compile-time (meta-)programming or type inference, callbacks without the overhead of function calls, doesn't enforce a single approach (multi-paradigm). POSIX and ECMAScript regular expressions. multiple return values. you can have named arguments. etc etc.

things move really slowly in programming. it took JavaScript 10 years to get off the ground (mostly because of performance), and most of people who program in it still don't get it (classes in JS? c'mon!). i'd say C++ will really start shining in 15-20 years from now. that seems to me like about the right amount of time for C++ (the language as well as compiler vendors) and critical mass of programmers who today write in dynamic languages to converge.

C++ needs to become more programmer-friendly (compiler errors generated from templates or compile times in the presence of same), and the programmers need to realize that static typing is a boon (it's already in progress, see other answer here which asserts that good code written in a dynamically typed language is written as if the language was statically typed).

1
  • C++ sucks C's and Objective-C's balls. It's an epic fail.
    – user142019
    Dec 20, 2010 at 14:41
1
vote

Simplicity Vs Optimality

I believe its very difficult to write code that's both simple and optimal.

1
vote

Python does everything that other programming languages do in half the dev time... and so does Google!!! Check out Unladen Swallow if you disagree.

Wait, this is a fact. Does it still qualify as an answer to this question?

2
  • Well, actually, Python still needs a bunch of C modules for some functionality.
    – Tor Valamo
    Dec 27, 2009 at 7:48
  • 2
    Unladen swallow is not ready for prime time except at certain places inside google, and the "2 to 10 times" faster than interpreted python doesn't come anywhere close to real-native-code speeds for most every work load out there that is not web-slinger centric. If "everything" means "the web crap I think of as programming" then, yeah, Python can do that. And I love python. But I also see that performance-just-as-fast-as-native thing as a crock. Oh and don't forget about the global interpreter lock (GIL).
    – Warren P
    Apr 1, 2010 at 0:07
0
votes

Once i saw the following from a co-worker:

equal = a.CompareTo(b) == 0;

I stated that he cannot assume that in a general case, but he just laughed.

12
  • I'd be interested in hearing your reasoning here - as well as which CompareTo method you're talking about.
    – Jon Skeet
    Jan 2, 2009 at 14:03
  • I'm taking about the C# IComparable.CompareTo method. Don't expect that two IComparable implementing objects are equal if the CompareTo method returns zero. They just have the same order.
    – Rauhotz
    Jan 2, 2009 at 14:09
  • Then your implementation of IComparable is broken. The docs state that a return value of zero means "This instance is equal to obj." I'm not saying that there aren't broken implementations out there, but your colleague can reasonably point to the docs...
    – Jon Skeet
    Jan 2, 2009 at 14:12
  • 2
    I'd argue that if things don't have a natural equality/ordering relationship, it's better to have a separate IComparer implementation, which can express this explicitly. There are certainly tricky edge cases - is 1.000m equal to 1.0m for example?
    – Jon Skeet
    Jan 2, 2009 at 14:14
  • that's a good case of narrow-minded view. check the lots of 'compare' predicates in Scheme
    – Javier
    Jan 2, 2009 at 14:21
0
votes

System.Data.DataSet Rocks!

Strongly-typed DataSets are better, in my opinion, than custom DDD objects for most business applications.

Reasoning: We're bending over backwards to figure out Unit of Work on custom objects, LINQ to SQL, Entity Framework and it's adding complexity. Use a nice code generator from somewhere to generate the data layer and the Unit of Work sits on the object collections (DataTable and DataSet)--no mystery.

3
  • You've obviously never used a DataSet then :P Jan 4, 2009 at 8:23
  • I have to disagree. IMO the DataSet is overkill for the vast majority of operations. And before it's asked, yes, I have used it.
    – Mike Hofer
    Jan 4, 2009 at 10:43
  • By the same reasoning, LINQ to SQL, Entity Framework, NHibernate, etc. are also overkill for the "vast majority" of operations. BTW, did you mean the "vast majority" of all operations or the "vast majority" of places where I'd use DDD? Jan 9, 2009 at 20:53
0
votes

Not everything needs to be encapsulated into its own method. Some times it is ok to have a method do more then one thing.

1
  • reminds me of an old manager of mine who abstracted himself out of a job. He spent months abstracting an app to make it "perfect" but in the end got nothing done.
    – Neil N
    Feb 19, 2009 at 22:37
0
votes

Don't worry too much about what language to learn, use the industry heavy weights like c# or python. Languages like Ruby are fun in the bedroom, but don't do squat in workplace scenarios. Languages like c# and Java can handle small to the very large software projects. If anyone says otherwise, then your talking about a scripting language. Period!

Before starting a project, consider how much support and code samples are available on the net. Again, choosing a language like Ruby which has very few code samples on the web compared to Java for example, will only cause you grief further down the road when your stuck on a problem.

You can't post a message on a forum and expect an answer back while your boss is asking you how your coding is going. What are you going to say? "I'm waiting for someone to help me out on this forum"

Learn one language and learn it good. Learning multiple languages may carry over skills and practices, but you'll only even be OK at all of them. Be good at one. There are entire books dedicated to Threading in Java which, when you think about it, is only one namespace out of over 100.

Master one or be ok at lots.

0
votes

USE of Desgin patterns and documentation

in web devlopment whats use of these things never felt any use of it

0
votes

Controversial to self, because some things are better be left unsaid, so you won't be painted by others as too egotist. However, here it is:

If it is to be, it begins with me

0
votes

Programming is so easy a five year old can do it.

Programming in and of itself is not hard, it's common sense. You are just telling a computer what to do. You're not a genius, please get over yourself.

9
  • 1
    I'm not a genius and I don't need to get over myself. In fact, not a day goes by that I don't question myself and wonder if just maybe I am a moron. And that's because I'm trying to tell a computer what it should do, and me realising that I'm not explaining it well enough. Jan 26, 2009 at 14:20
  • 2
    Please submit your five year olds resume to my HR personell. ;) Jan 27, 2009 at 3:36
  • Explain x = 4 * 7 to a 5-year old. Feb 6, 2009 at 14:35
  • 3
    Programming can be done by a 5-year-old. Good programming takes experience, self-discipline, and self-criticism, not traits found in your average 5-year-old (or many professionals, either).
    – DevSolar
    Oct 16, 2009 at 9:05
  • 4
    i started programming when i was 1. i used a 1bit stream to tell my mother change my pampers. it was {guess}.
    – Behrooz
    Dec 14, 2009 at 20:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.