Code comments

Code comments

Swearing warning :-)

I’ve come across this nice Stack Overflow entry, which lists the best code comments found by the users.

This is the highest rated:

    //Code sanitized to protect the foolish.
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Reflection;
    using System.Web.UI;
    namespace Mobile.Web.Control
    {
        ///
        /// Class used to work around Richard being a fucking idiot
        ///
        ///
        /// The point of this is to work around his poor design so that paging will
        /// work on a mobile control. The main problem is the BindCompany() method,
        /// which he hoped would be able to do everything. I hope he dies.
        ///
        public abstract class RichardIsAFuckingIdiotControl : MobileBaseControl, ICompanyProfileControl
        {
            protected abstract Pager Pager { get; }
            public void BindCompany(int companyId) { }
            public RichardIsAFuckingIdiotControl()
            {
                MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity();
            }
            private void MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity()
            {
                // Make sure nobody is actually using that fucking bindcompany method
                MethodInfo m = this.GetType().GetMethod("BindCompany", BindingFlags.DeclaredOnly |
                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                if (m != null)
                {
                    throw new RichardIsAFuckingIdiotException("No!! Don't use the fucking BindCompany method!!!");
                }
                // P.S. this method is a joke ... the rest of the class is fucking serious
            }
            ///
            /// This returns true if this control is supposed to be doing anything
            /// at all for this request. Richard thought it was a good idea to load
            /// the entire website during every request and have things turn themselves
            /// off. He also thought bandanas and aviator sunglasses were "fuckin'
            /// gnarly, dude."
            ///
            protected bool IsThisTheRightPageImNotSureBecauseRichardIsDumb()
            {
                return Request.QueryString["Section"] == this.MenuItemKey;
            }
            protected override void OnLoad(EventArgs e)
            {
                if (IsThisTheRightPageImNotSureBecauseRichardIsDumb())
                {
                    Page.LoadComplete += new EventHandler(Page_LoadComplete);
                    Pager.RowCount = GetRowCountBecauseRichardIsDumb();
                }
                base.OnLoad(e);
            }
            protected abstract int GetRowCountBecauseRichardIsDumb();
            protected abstract void BindDataBecauseRichardIsDumb();
            void Page_LoadComplete(object sender, EventArgs e)
            {
                BindDataBecauseRichardIsDumb();
            }
            // the rest of his reduh-ndant interface members
            public abstract string MenuItemName { get; set; }
            public abstract string MenuItemKey { get; set; }
            public abstract bool IsCapable(CapabilityCheck checker, int companyId);
            public abstract bool ShowInMenu { get; }
            public virtual Control CreateHeaderControl()
            {
                return null;
            }
        }
    }

This is the second:

stop(); // Hammertime!

(people may have not understood it, but it’s probably related to teeworlds.

Check the other entries !

This seems like a great time to subscribe my RSS !

One response to “Code comments”

  1. Ben

    The hammer time comment is from MC Hammer’s track ‘U Can’t Touch this’

Leave a Reply

Bills

Don’t forget to Subscribe

Latest Activity

Posts

  • Google Plus keeps your data as much as Facebook does
    When you delete an account from Google+, Google promises you to delete all the data associated with your G+ profile. Well, I deleted mine some time Read More
  • Rapache returns ?
    Not without a certain pleasure I announce that I got Rapache fixed and working again. Rapache is a graphical user tool to help you configure Apache2. Read More
  • Linux on Javascript
    It may very well be an old news already, but it’s so amazing I just have to share it. Fabrice Bellard wrote a more or less Read More
  • Steve Jobs passes away
    Steve Jobs passed away some hour ago. Love or hate Apple products, you still have to admit he had a big impact on the world. He Read More
  • Wikipedia Italia closes up.
    Just a quick notice to let you lovely foreigners know that the italian version of Wikipedia just closed everything down in sign of protest against Read More