Skip to content

Instantly share code, notes, and snippets.

@Potherca
Last active October 17, 2022 04:27
Show Gist options
  • Select an option

  • Save Potherca/8b91a5212e29d3a8178f382de647d406 to your computer and use it in GitHub Desktop.

Select an option

Save Potherca/8b91a5212e29d3a8178f382de647d406 to your computer and use it in GitHub Desktop.

Revisions

  1. Potherca revised this gist Oct 1, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -16,9 +16,9 @@ The mug looks quite nice but sadly the code on it is crap.
    - The logic is only run once
    - The comment is totally useless
    - The code style does not adhere to the [C# coding standards for .NET](http://se.inf.ethz.ch/old/teaching/ss2007/251-0290-00/project/CSharpCodingStandards.pdf)
    - 2.3. Do not create declarations of the same type (namespace, class, method, property, field, or parameter) and access modifier (protected, public, private, internal) that vary only by capitalization.
    - 2.18. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
    - 4.3.33. Avoid invoking methods within a conditional expression.
    - Rule 2.3. Do not create declarations of the same type (namespace, class, method, property, field, or parameter) and access modifier (protected, public, private, internal) that vary only by capitalization.
    - Rule 2.18. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
    - Rule 4.3.33. Avoid invoking methods within a conditional expression.
    - There is no logging, error handling or messaging

    Honestly, if I came across such code in a peer review it would not pass.
  2. Potherca revised this gist Oct 1, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ The mug looks quite nice but sadly the code on it is crap.

    - The code is not placed in a separate namespace
    - A `var` keyword is not used when assigning the `Coffee` object
    - The object oriënted style abstraction is broken
    - The object oriented style abstraction is broken
    - There is no container for the coffee
    - There is no dispenser for the coffee
    - There is no person to drink the coffee
  3. Potherca revised this gist Oct 1, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -27,4 +27,4 @@ Beside these issues, the code is written in [C#](https://en.wikipedia.org/wiki/C

    At a certain point I might feel like writing a better version.

    Right now, my coffee mug is empty, so I'm going to get a refil first ;-)
    Right now, my coffee mug is empty, so I'm going to get a refill first ;-)
  4. Potherca revised this gist Oct 1, 2016. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -4,21 +4,21 @@ There is a post going round on facebook of a mug with some code on it.
    There's even [a reddit post on it](https://www.reddit.com/r/csharp/comments/3xdikm/does_anybody_know_where_i_can_find_this_mug/?st=itrfyyvi&sh=e8448c85).
    The mug looks quite nice but sadly the code on it is crap.

    - The object oriënted style abstraction
    - The code is not placed in a separate namespace
    - A `var` keyword is not used when assigning the `Coffee` object
    - The object oriënted style abstraction is broken
    - There is no container for the coffee
    - There is no dispenser for the cofee
    - There is no dispenser for the coffee
    - There is no person to drink the coffee
    - There is no SoftwareDeveloper object
    - The code is not placed in a separate namespace
    - There are flaws in the logic
    - When the `coffee` is refilled it is not drunk
    - The logic is only run once
    - The comment is totally useless
    - The code style does not adhere to the [C# coding standards for .NET](http://se.inf.ethz.ch/old/teaching/ss2007/251-0290-00/project/CSharpCodingStandards.pdf)
    - 2.3. Do not create declarations of the same type (namespace, class, method, property, field, or parameter) and access modifier (protected, public, private, internal) that vary only by capitalization.
    - 2.18. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
    - 4.3.33. Avoid invoking methods within a conditional expression.
    - A `var` keyword is not used when assigning the `Coffee` object
    - The comment is totally useless
    - There are flaws in the logic
    - When the `coffee` is refilled it is not drunk
    - The logic is only run once
    - There is no logging, error handling or messaging

    Honestly, if I came across such code in a peer review it would not pass.
  5. Potherca revised this gist Oct 1, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,12 @@ The mug looks quite nice but sadly the code on it is crap.
    - There is no dispenser for the cofee
    - There is no person to drink the coffee
    - There is no SoftwareDeveloper object
    - The code style is disappointing
    - The code is not placed in a separate namespace
    - The code style does not adhere to the [C# coding standards for .NET](http://se.inf.ethz.ch/old/teaching/ss2007/251-0290-00/project/CSharpCodingStandards.pdf)
    - 2.3. Do not create declarations of the same type (namespace, class, method, property, field, or parameter) and access modifier (protected, public, private, internal) that vary only by capitalization.
    - 2.18. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
    - 4.3.33. Avoid invoking methods within a conditional expression.
    - A `var` keyword is not used when assigning the `Coffee` object
    - The comment is totally useless
    - There are flaws in the logic
    - When the `coffee` is refilled it is not drunk
  6. Potherca revised this gist Oct 1, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@ The mug looks quite nice but sadly the code on it is crap.
    - There is no container for the coffee
    - There is no dispenser for the cofee
    - There is no person to drink the coffee
    - There is no SoftwareDeveloper object
    - The code style is disappointing
    - The comment is totally useless
    - There are flaws in the logic
  7. Potherca revised this gist Oct 1, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,8 @@ The mug looks quite nice but sadly the code on it is crap.

    Honestly, if I came across such code in a peer review it would not pass.

    Beside these issues, the code is written in [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) (created by Microsoft) and not in the more suitable [CoffeeScript](http://coffeescript.org/)

    At a certain point I might feel like writing a better version.

    Right now, my coffee mug is empty, so I'm going to get a refil first ;-)
  8. Potherca revised this gist Oct 1, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    There is a post going round on facebook of a mug with some code on it.
    ![](http://i.imgur.com/uvCHW7C.jpg)

    There is a post going round on facebook of a mug with some code on it.
    There's even [a reddit post on it](https://www.reddit.com/r/csharp/comments/3xdikm/does_anybody_know_where_i_can_find_this_mug/?st=itrfyyvi&sh=e8448c85).
    The mug looks quite nice but sadly the code on it is crap.

  9. Potherca revised this gist Oct 1, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    There is a post going round on facebook of a mug with some code on it.
    There is a post going round on facebook of a mug with some code on it.
    ![](http://i.imgur.com/uvCHW7C.jpg)
    There's even [a reddit post on it](https://www.reddit.com/r/csharp/comments/3xdikm/does_anybody_know_where_i_can_find_this_mug/?st=itrfyyvi&sh=e8448c85).
    The mug looks quite nice but sadly the code on it is crap.

    - The object oriënted style abstraction
  10. Potherca revised this gist Oct 1, 2016. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions Everything Wrong with the Code on That Mug.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    There is a post going round on facebook of a mug with some code on it. The mug looks quite nice but sadly the code on it is crap.
    There is a post going round on facebook of a mug with some code on it.
    The mug looks quite nice but sadly the code on it is crap.

    - The object oriënted style abstraction
    - There is no container for the coffee
    @@ -13,4 +14,6 @@ There is a post going round on facebook of a mug with some code on it. The mug l

    Honestly, if I came across such code in a peer review it would not pass.

    At a certain point I might feel like writing a better version but my coffee mug is empty right now, so I'm going to get a refil first ;-)
    At a certain point I might feel like writing a better version.

    Right now, my coffee mug is empty, so I'm going to get a refil first ;-)
  11. Potherca renamed this gist Oct 1, 2016. 1 changed file with 0 additions and 0 deletions.
  12. Potherca created this gist Oct 1, 2016.
    16 changes: 16 additions & 0 deletions Everything Wrong with the Code on That Mug
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    There is a post going round on facebook of a mug with some code on it. The mug looks quite nice but sadly the code on it is crap.

    - The object oriënted style abstraction
    - There is no container for the coffee
    - There is no dispenser for the cofee
    - There is no person to drink the coffee
    - The code style is disappointing
    - The comment is totally useless
    - There are flaws in the logic
    - When the `coffee` is refilled it is not drunk
    - The logic is only run once
    - There is no logging, error handling or messaging

    Honestly, if I came across such code in a peer review it would not pass.

    At a certain point I might feel like writing a better version but my coffee mug is empty right now, so I'm going to get a refil first ;-)
    13 changes: 13 additions & 0 deletions original-code.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    Coffee coffee = new Coffee();

    if (coffee.Empty)
    {
    coffee.Refill()
    }
    else
    {
    coffee.Drink()
    }


    //I am a software developer