Hacker Newsnew | past | comments | ask | show | jobs | submit | hasslblad's commentslogin

I think it's because IE6 is the default browser for Windows XP Installs. I think even with the later Windows XP Service Packs, they still baselined to IE6.

That and there was a big gap in time between IE6 and IE7. Didn't Microsoft once announce that IE6 would be their last browser, as that's all the world needs?


It's worth noting Scott McCloud also did the Google Chrome comic - http://www.google.com/googlebooks/chrome/



I agree with this. At first glance the problems he presents are simple, then you realise all the design decisions they've made and the pros and cons of each approach they were aware of when writing C#.

On a footnote I also recommend Jon Skeet: Coding Blog - http://msmvps.com/blogs/jon_skeet/ He's known in the .Net community. He's the guy behind Tony the Pony. He's a Google staffer who has written some C# books. He goes into great depth about C# stuff.


This has happened to British Agents before in WWII. I remember seeing a documentary about training British agents to infiltrate France. While in France one agent got caught out by asking for a black coffee. This was the default coffee at the time in France, people would just ask for a coffee and expect a black coffee. This made him stand out.

There are similar stories like this in movies, such as the Great Escape, when one of the escaping prisoners is dressed as a civilian and is boarding a bus in town. A German Officer says in English "Good luck", the prisoner replies in English "thank you" and is caught.


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

[Edit: As with all British males born in the 60s or 70s I have seen the Great Escape roughly 73,000 times].


Newspapers and the press in general normally have an obituary team who write and update obituaries for noteworthy people who are still alive. That way if anything happens, they can be quick off the mark and publish a well researched article about the person. Occasionally these are published in error when the person in question is still alive.


This actually happened to Jobs a few years ago.


Or Even this.MyControl.TabPages.Clear();


As soon as I saw that snippet I could see what's wrong.

In C# / .Net you can't remove an element from an enumerator while you're enumerating through it. You can remove the last element however, as it's the final loop the enumerator isn't used again so it won't throw an error. The original developer probably tried to remove it forward only first, encountered an error and wrote the code to loop through it backwards, using the random tweaking technique.

What's rather depressing is that a lot of developers I've encountered use the random tweaking methodology, instead of figuring out what's really happening.


Actually, that's not the problem :)

The can't-modify-a-collection-while-enumerating-it issue only comes into play if you're actually using an enumerator (either directly, or as part of a foreach loop) - the code in the article uses a plain for loop along with indexing into the collection, and wouldn't run into the problem.

Rather, the primary "issue" is that without that "i--" at the end it only removes half the elements - after removing an element, all the following elements shift back one index, and so the very next element never gets removed.


Sorry, I should have been clearer. I was getting flashbacks to when I saw a similar problem (except in a for each loop), that's what set the alarm bells ringing in my head.

When I see nasty code like that, I tend to stop parsing it fully and sniff out the intent. I think it's a form of bad code blindness (like banner ad blindness) my brain is protecting me from all the bad code I've seen. If I fully parsed all the really bad code properly I’d become a dribbling wreck. :) So I tend to look at it at a higher level instead to stay sane.


1. No iterator is being used here, so the iterator coherence check does not come into play

2. List elements are removed from the front, the code is essentially a complicated version of:

    while (0 < this.MyControl.TabPages.Count) {
        this.MyControl.TabPages.Remove(0);
    }


I've also found it depressing that you can't remove an element fron an enumerator while you're enumerating through it

Why? I like to think library developers have my back. What's the point in an iterator, it its broken on the 1st thing I try? (Ok the 2nd thing; 1st I code a search through the list, then the teardown)

Iterators are also pretty much broken when 1) inserting into a list, 2) merging a list into a list, 3) deleting an item from a list.

Ok, they're pretty much broken for absolutely everything BUT searching lists.

I remember the profound disappointment I felt when Java 1 came out, and its iterators were this same lame junk.

So I never use them. They are born to create bugs like this one.


Yeah well except that that's not even related to what's happening here. Good thing though that you spotted it immediately and that you're smarter than all the developers you encounter ^_^


Well, when working on a code base, the first thing I think is who wrote this and when. When they wrote this how experienced was the developer? What's there coding style or was it written after coding standards were introduced? I've had this misfortune of inheriting a lot of bad legacy code in the past and when you see a chunk of bad code, you can either spend a good chunk of time figuring what it's really doing or less time figuring out the intent. Depending on who wrote the code, what it does, and various other factors you can decide which path to take.

With this code snippet it's obvious that the intent is to remove all the elements. So it can be fixed with a .Clear();

From a higher level, you can see that the snippet smells bad, and will need some attention.

I didn't say I'm smarter than all the developers I encounter. I've just encountered a lot of bad developers in my time.


Google did this when they first launched Chrome too - http://www.google.com/googlebooks/chrome/index.html


One (interesting?) thing to note is the Chrome comic was drawn by Scott McCloud, professional comic book artist extroidinare.

The Correlate comic was drawn by Manu Cornet, who's a Googler: https://plus.google.com/106154493978299996445/posts


Most of the talk of Google buying Motorola Mobile has been about the patents and more control over the hardware. I think it's also important to consider the tax breaks Google could be aiming for -

http://www.theregister.co.uk/2011/09/01/google_buys_tax_brea...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: