diff --git a/Articles/Blogging/5 Big Mistakes I Made Writing Technical Articles/readme.md b/Articles/Blogging/5 Big Mistakes I Made Writing Technical Articles/readme.md index 7e5f37c1..20532d19 100644 --- a/Articles/Blogging/5 Big Mistakes I Made Writing Technical Articles/readme.md +++ b/Articles/Blogging/5 Big Mistakes I Made Writing Technical Articles/readme.md @@ -62,7 +62,7 @@ I will keep gist for control version, but not for embedding. Try reading this: -[Gist Url]: # (https://gist.github.com/mcsee/49382a7cff708d0b4a8c2e602295484f) + ```javascript movie.rate.warnIfNotAllowed(this.age); diff --git a/Articles/Book/3.2 Identifying the Essence of Your Objects/readme.md b/Articles/Book/3.2 Identifying the Essence of Your Objects/readme.md index 73d9892b..f8033171 100644 --- a/Articles/Book/3.2 Identifying the Essence of Your Objects/readme.md +++ b/Articles/Book/3.2 Identifying the Essence of Your Objects/readme.md @@ -2,7 +2,7 @@ ![3.2 Identifying the Essence of Your Objects](3.2%20Identifying%20the%20Essence%20of%20Your%20Objects.png) -> TL;DR: +> TL;DR: https://gist.github.com/mcsee/7c1ee7181f403225470c90c2f4668f99 diff --git a/Articles/Code Smells/Code Smell 01 - Anemic Models/readme.md b/Articles/Code Smells/Code Smell 01 - Anemic Models/readme.md index 0fa2a0d3..5f0e9b56 100644 --- a/Articles/Code Smells/Code Smell 01 - Anemic Models/readme.md +++ b/Articles/Code Smells/Code Smell 01 - Anemic Models/readme.md @@ -40,7 +40,7 @@ If we ask a domain expert to describe an entity he/she would hardly tell it is * ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/73f84d80f7c3e89a216dd9e40ab71bcc) + ```java public class Song { @@ -52,7 +52,7 @@ public class Song { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/78f2dd78120db843c960ed41839f29cb) + ```java public class Song { diff --git a/Articles/Code Smells/Code Smell 02 - Constants and Magic Numbers/readme.md b/Articles/Code Smells/Code Smell 02 - Constants and Magic Numbers/readme.md index d8ca1e26..1908dd3d 100644 --- a/Articles/Code Smells/Code Smell 02 - Constants and Magic Numbers/readme.md +++ b/Articles/Code Smells/Code Smell 02 - Constants and Magic Numbers/readme.md @@ -30,7 +30,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/dec9856bf69a06c367d2e683b179577a) + ```php ```ruby # Storing magnitudes without units is another smell diff --git a/Articles/Code Smells/Code Smell 03 - Functions Are Too Long/readme.md b/Articles/Code Smells/Code Smell 03 - Functions Are Too Long/readme.md index a3f6fd54..5f5cfb01 100644 --- a/Articles/Code Smells/Code Smell 03 - Functions Are Too Long/readme.md +++ b/Articles/Code Smells/Code Smell 03 - Functions Are Too Long/readme.md @@ -33,7 +33,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/1f12fb2d0cb9f8eea202526597cf4b83) + ```php ```php ```php ```php ```php ```php ```javascript function primeFactors(n) { @@ -55,7 +55,7 @@ function primeFactors(n) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/4749cfe51de1c02848df1aa802fa5705) + ```javascript function primeFactors(numberToFactor) { diff --git a/Articles/Code Smells/Code Smell 07 - Boolean Variables/readme.md b/Articles/Code Smells/Code Smell 07 - Boolean Variables/readme.md index 61a8894d..d4bdd35f 100644 --- a/Articles/Code Smells/Code Smell 07 - Boolean Variables/readme.md +++ b/Articles/Code Smells/Code Smell 07 - Boolean Variables/readme.md @@ -26,7 +26,7 @@ This also follows [Open/Closed Principle](https://en.wikipedia.org/wiki/Open%E2% ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/5a3e8e05def917a29b84be7264493a67) + ```php ```php ```javascript class Dog { @@ -51,7 +51,7 @@ for (var foot of dog.getFeet()) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/b3b7d73ffb6554df2c06fce3b93a134f) + ```javascript class Dog { diff --git a/Articles/Code Smells/Code Smell 09 - Dead Code/readme.md b/Articles/Code Smells/Code Smell 09 - Dead Code/readme.md index df9adb9f..d06e84c1 100644 --- a/Articles/Code Smells/Code Smell 09 - Dead Code/readme.md +++ b/Articles/Code Smells/Code Smell 09 - Dead Code/readme.md @@ -23,7 +23,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/9e793df7489a96dc27d29d0f4e963bdf) + ```javascript class Robot { @@ -41,7 +41,7 @@ class Robot { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/e1075cc971b5f7af28e37d29b492735d) + ```javascript class Robot { diff --git a/Articles/Code Smells/Code Smell 10 - Too Many Arguments/readme.md b/Articles/Code Smells/Code Smell 10 - Too Many Arguments/readme.md index d0022f20..fbc3d991 100644 --- a/Articles/Code Smells/Code Smell 10 - Too Many Arguments/readme.md +++ b/Articles/Code Smells/Code Smell 10 - Too Many Arguments/readme.md @@ -28,7 +28,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/ea7d32472830d5ea877be1438807fe89) + ```java public class Printer { @@ -50,7 +50,7 @@ public class Printer { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/200a18dd99a76a95155df4cb032b1d10) + ```java final public class PaperSize { } diff --git a/Articles/Code Smells/Code Smell 100 - GoTo/readme.md b/Articles/Code Smells/Code Smell 100 - GoTo/readme.md index 320ae550..b1ff8c5e 100644 --- a/Articles/Code Smells/Code Smell 100 - GoTo/readme.md +++ b/Articles/Code Smells/Code Smell 100 - GoTo/readme.md @@ -30,7 +30,7 @@ I had to learn structured programming from scratch in Rehab mode. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/5d76fda8dfbe6f351e709baa00e0e61c) + ```csharp int i = 0; @@ -46,7 +46,7 @@ if (i < 10) ## Right -[Gist Url]: # (https://gist.github.com/mcsee/da74b8e901f234b6bc400c9a6e0b7725) + ```csharp for (int i = 0; i < 10; i++) diff --git a/Articles/Code Smells/Code Smell 101 - Comparison Against Booleans/readme.md b/Articles/Code Smells/Code Smell 101 - Comparison Against Booleans/readme.md index 67ceb2bd..9d889be6 100644 --- a/Articles/Code Smells/Code Smell 101 - Comparison Against Booleans/readme.md +++ b/Articles/Code Smells/Code Smell 101 - Comparison Against Booleans/readme.md @@ -28,7 +28,7 @@ Many languages cast values to boolean crossing domains. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/118ff2e5ebd9779675f664ed46bae95d) + ```bash #!/bin/bash @@ -53,7 +53,7 @@ fi ## Right -[Gist Url]: # (https://gist.github.com/mcsee/405d45ed06a94a81d1f1a3b06381c0f9) + ```bash #!/bin/bash diff --git a/Articles/Code Smells/Code Smell 103 - Double Encapsulation/readme.md b/Articles/Code Smells/Code Smell 103 - Double Encapsulation/readme.md index 13df12cf..dff8a0ac 100644 --- a/Articles/Code Smells/Code Smell 103 - Double Encapsulation/readme.md +++ b/Articles/Code Smells/Code Smell 103 - Double Encapsulation/readme.md @@ -38,7 +38,7 @@ Cost/benefit is not worth it. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/6f91efd52401b93f91322f20ab6d3aab) + ```solidity contract MessageContract { @@ -61,7 +61,7 @@ contract MessageContract { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/91d0aa627815f79d471fa79150c5dc9b) + ```solidity contract MessageContract { diff --git a/Articles/Code Smells/Code Smell 104 - Assert True/readme.md b/Articles/Code Smells/Code Smell 104 - Assert True/readme.md index c7ae82e5..62cebabf 100644 --- a/Articles/Code Smells/Code Smell 104 - Assert True/readme.md +++ b/Articles/Code Smells/Code Smell 104 - Assert True/readme.md @@ -28,7 +28,7 @@ Error tracking gets more difficult. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/c54f0b1ee42d6a1aff640507e0bdf625) + ```php ```php ```javascript function erradicateAndMurderAllCustomers(); @@ -35,7 +35,7 @@ function erradicateAndMurderAllCustomers(); ## Right -[Gist Url]: # (https://gist.github.com/mcsee/19ae535002ea19708c13334a1171af37) + ```javascript function deleteAllCustomers(); diff --git a/Articles/Code Smells/Code Smell 106 - Production Dependent Code/readme.md b/Articles/Code Smells/Code Smell 106 - Production Dependent Code/readme.md index f50bfd3a..3d7df054 100644 --- a/Articles/Code Smells/Code Smell 106 - Production Dependent Code/readme.md +++ b/Articles/Code Smells/Code Smell 106 - Production Dependent Code/readme.md @@ -28,7 +28,7 @@ In this case, we need to configure the environment with the strength strategy an ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/2b00edcf1fded330263a4773b227cd06) + ```python def send_welcome_email(email_address, environment): @@ -48,7 +48,7 @@ send_welcome_email("john@doe.com", "production") ## Right -[Gist Url]: # (https://gist.github.com/mcsee/4a598f416f01357597a072d75ba30a6f) + ```python class ProductionEnvironment: diff --git a/Articles/Code Smells/Code Smell 107 - Variables Reuse/readme.md b/Articles/Code Smells/Code Smell 107 - Variables Reuse/readme.md index 5386af9d..dc14c23b 100644 --- a/Articles/Code Smells/Code Smell 107 - Variables Reuse/readme.md +++ b/Articles/Code Smells/Code Smell 107 - Variables Reuse/readme.md @@ -30,7 +30,7 @@ We should narrow the scope as much as possible. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/88615884493c78d45a57be565964ae5b) + ```java // print line total @@ -46,7 +46,7 @@ System.out.println( "Amount due: " + total); ## Right -[Gist Url]: # (https://gist.github.com/mcsee/9657946be3bcd5a81aebc12d4ef82d0b) + ```java function printLineTotal() { diff --git a/Articles/Code Smells/Code Smell 108 - Float Assertions/readme.md b/Articles/Code Smells/Code Smell 108 - Float Assertions/readme.md index 1528824e..08b420da 100644 --- a/Articles/Code Smells/Code Smell 108 - Float Assertions/readme.md +++ b/Articles/Code Smells/Code Smell 108 - Float Assertions/readme.md @@ -34,7 +34,7 @@ We recommend avoiding floats at all and trying to use infinite precision numbers ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/2fc79af85305eaada328fd324cb38c0d) + ```java Assert.assertEquals(0.0012f, 0.0012f); // Deprecated @@ -43,7 +43,7 @@ Assert.assertTrue(0.0012f == 0.0012f); // Not JUnit - Smell ## Right -[Gist Url]: # (https://gist.github.com/mcsee/570958fcfb8e52379b7ddde2389ad6f8) + ```java Assert.assertEquals(0.0012f, 0.0014f, 0.0002); // true diff --git a/Articles/Code Smells/Code Smell 109 - Automatic Properties/readme.md b/Articles/Code Smells/Code Smell 109 - Automatic Properties/readme.md index c45e7936..6c878c9b 100644 --- a/Articles/Code Smells/Code Smell 109 - Automatic Properties/readme.md +++ b/Articles/Code Smells/Code Smell 109 - Automatic Properties/readme.md @@ -32,7 +32,7 @@ Some languages provide explicit support to build anemic models and DTOs. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/2353f11cfb336aaeda194c4a11a21324) + ```csharp class Person @@ -44,7 +44,7 @@ class Person ## Right -[Gist Url]: # (https://gist.github.com/mcsee/198d8a232bd1abf52cda0884fb96bc5f) + ```csharp class Person diff --git a/Articles/Code Smells/Code Smell 11 - Subclassification for Code Reuse/readme.md b/Articles/Code Smells/Code Smell 11 - Subclassification for Code Reuse/readme.md index 5ab2badc..29f0fec3 100644 --- a/Articles/Code Smells/Code Smell 11 - Subclassification for Code Reuse/readme.md +++ b/Articles/Code Smells/Code Smell 11 - Subclassification for Code Reuse/readme.md @@ -20,7 +20,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/4f53d085c8b566936c04483064e25ed9) + ```java public class Rectangle { @@ -56,7 +56,7 @@ public class Box extends Rectangle{ ## Right -[Gist Url]: # (https://gist.github.com/mcsee/9f0082db40c2ab590b2b6ea9702bbb22) + ```java abstract public class Shape{ diff --git a/Articles/Code Smells/Code Smell 110 - Switches With Defaults/readme.md b/Articles/Code Smells/Code Smell 110 - Switches With Defaults/readme.md index 4a2ac9d5..78c8ef98 100644 --- a/Articles/Code Smells/Code Smell 110 - Switches With Defaults/readme.md +++ b/Articles/Code Smells/Code Smell 110 - Switches With Defaults/readme.md @@ -32,7 +32,7 @@ Since [case and switches](https://github.com/mcsee/Software-Design-Articles/tree ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/ddad35dc0be43c82d4aff94ad2b79d09) + ```javascript switch (value) { @@ -55,7 +55,7 @@ switch (value) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/78ca0363b28677b5ff24973b2fc4806f) + ```javascript switch (value) { diff --git a/Articles/Code Smells/Code Smell 111 - Modifying Collections While Traversing/readme.md b/Articles/Code Smells/Code Smell 111 - Modifying Collections While Traversing/readme.md index 3629a8e6..dc996b35 100644 --- a/Articles/Code Smells/Code Smell 111 - Modifying Collections While Traversing/readme.md +++ b/Articles/Code Smells/Code Smell 111 - Modifying Collections While Traversing/readme.md @@ -32,7 +32,7 @@ Modifying them is generally not safe. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/9d66e179c57495aa7c2080ee34152c11) + ```java // here you add elements to the collection... @@ -49,7 +49,7 @@ for (Object person : people) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/18369eb8798462ef04372be56827c9d6) + ```java Collection people = new ArrayList<>(); diff --git a/Articles/Code Smells/Code Smell 112 - Testing Private Methods/readme.md b/Articles/Code Smells/Code Smell 112 - Testing Private Methods/readme.md index 0c02466b..34caf333 100644 --- a/Articles/Code Smells/Code Smell 112 - Testing Private Methods/readme.md +++ b/Articles/Code Smells/Code Smell 112 - Testing Private Methods/readme.md @@ -40,7 +40,7 @@ At some point, we rely on auxiliary computations and we need to test them in a w ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/47c21b9a717ee1ac9b7d2f10bbb7a2d0) + ```php ```php ```javascript if (!dataExists()) { @@ -42,7 +42,7 @@ if (!dataExists()) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/945e6a64fd3167637ff1e1eb872ff179) + ```javascript if (!peopleFound()) { diff --git a/Articles/Code Smells/Code Smell 114 - Empty Class/readme.md b/Articles/Code Smells/Code Smell 114 - Empty Class/readme.md index 86ad5471..a53028ed 100644 --- a/Articles/Code Smells/Code Smell 114 - Empty Class/readme.md +++ b/Articles/Code Smells/Code Smell 114 - Empty Class/readme.md @@ -32,7 +32,7 @@ They couple *different behavior* concept with *returning different data*. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/729e6032d21c0c2997228680170ff768) + ```javascript class ShopItem { @@ -50,7 +50,7 @@ class BookItem extends ShopItem { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/a8c680954291f8d9be4023ff8062b504) + ```javascript class ShopItem { diff --git a/Articles/Code Smells/Code Smell 115 - Return True/readme.md b/Articles/Code Smells/Code Smell 115 - Return True/readme.md index 90643c0e..455ea2b3 100644 --- a/Articles/Code Smells/Code Smell 115 - Return True/readme.md +++ b/Articles/Code Smells/Code Smell 115 - Return True/readme.md @@ -30,7 +30,7 @@ When we create complex and mature software, we start to forget about this primit ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/973a11295d0d93baa620763dd8eff801) + ```java boolean isEven(int num) { @@ -44,7 +44,7 @@ boolean isEven(int num) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/ab38ef6fcc5dd6dea98f1edb452e75e9) + ```java boolean isEven(int numberToCheck) { diff --git a/Articles/Code Smells/Code Smell 117 - Unrealistic Data/readme.md b/Articles/Code Smells/Code Smell 117 - Unrealistic Data/readme.md index 5db326ab..c547c119 100644 --- a/Articles/Code Smells/Code Smell 117 - Unrealistic Data/readme.md +++ b/Articles/Code Smells/Code Smell 117 - Unrealistic Data/readme.md @@ -38,7 +38,7 @@ If we find an error in a production system, we need to add a case covering the e ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/d9b312e97d7233738ea06f322ae41da1) + ```python class BookCartTestCase(unittest.TestCase): @@ -76,7 +76,7 @@ class BookCartTestCase(unittest.TestCase): ## Right -[Gist Url]: # (https://gist.github.com/mcsee/539d4699db494d180219620b7baeedea) + ```python class BookCartTestCase(unittest.TestCase): diff --git a/Articles/Code Smells/Code Smell 118 - Return False/readme.md b/Articles/Code Smells/Code Smell 118 - Return False/readme.md index f37e2679..208f67fd 100644 --- a/Articles/Code Smells/Code Smell 118 - Return False/readme.md +++ b/Articles/Code Smells/Code Smell 118 - Return False/readme.md @@ -30,7 +30,7 @@ Programmers tend to return accidental implementative solutions instead of real b ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/57c079a22fe139667c8330a937d4dcca) + ```javascript function canWeMoveOn() { @@ -43,7 +43,7 @@ function canWeMoveOn() { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/0f0cfe7cd5133dc605555eeb20feaa95) + ```javascript function canWeMoveOn() { diff --git a/Articles/Code Smells/Code Smell 119 - Stairs Code/readme.md b/Articles/Code Smells/Code Smell 119 - Stairs Code/readme.md index 40f0b910..11aca35c 100644 --- a/Articles/Code Smells/Code Smell 119 - Stairs Code/readme.md +++ b/Articles/Code Smells/Code Smell 119 - Stairs Code/readme.md @@ -28,7 +28,7 @@ When dealing with boolean formulas, it is more readable to show a business boole ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/b7125d33f30a8a37a40bc994fe7fcba6) + ```python def is_platypus(self): @@ -58,7 +58,7 @@ def is_platypus(self): ## Right -[Gist Url]: # (https://gist.github.com/mcsee/b0afdb15577225b97f66381872f373f1) + ```python def is_platypus(self): diff --git a/Articles/Code Smells/Code Smell 12 - Null/readme.md b/Articles/Code Smells/Code Smell 12 - Null/readme.md index 4923cca9..3192ce1e 100644 --- a/Articles/Code Smells/Code Smell 12 - Null/readme.md +++ b/Articles/Code Smells/Code Smell 12 - Null/readme.md @@ -33,7 +33,7 @@ Multiple semantics lead to coupling and errors.* ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/2f7aee362e99fbe447d8c1e8aaeb9f8e) + ```javascript class CartItem { @@ -84,7 +84,7 @@ cart = new Cart([ ## Right -[Gist Url]: # (https://gist.github.com/mcsee/a7571cf0ce9e7666bd6a393520f9a968) + ```javascript class CartItem { diff --git a/Articles/Code Smells/Code Smell 120 - Sequential IDs/readme.md b/Articles/Code Smells/Code Smell 120 - Sequential IDs/readme.md index 0619a030..7999cd94 100644 --- a/Articles/Code Smells/Code Smell 120 - Sequential IDs/readme.md +++ b/Articles/Code Smells/Code Smell 120 - Sequential IDs/readme.md @@ -34,7 +34,7 @@ These are always [accidental problems](https://github.com/mcsee/Software-Design- ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/095409b419d460484cc418d549861c98) + ```java class Book { @@ -51,7 +51,7 @@ Book donQuixote = new Book(3, List.of(5)); ## Right -[Gist Url]: # (https://gist.github.com/mcsee/83b1660ec07e5bafd0a5b1c567f76aee) + ```java class Author { } diff --git a/Articles/Code Smells/Code Smell 121 - String Validations/readme.md b/Articles/Code Smells/Code Smell 121 - String Validations/readme.md index d7ac9108..f9133d91 100644 --- a/Articles/Code Smells/Code Smell 121 - String Validations/readme.md +++ b/Articles/Code Smells/Code Smell 121 - String Validations/readme.md @@ -38,7 +38,7 @@ The simple solution is to build only real-world and valid abstractions. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/1b6799dac071ce8bd2a1082dfdbd668d) + ```php ```php ```java int port = 8080; @@ -56,7 +56,7 @@ String path = pathFromPort("example.org", port); ## Right -[Gist Url]: # (https://gist.github.com/mcsee/32202947a8d5ef760936a1e094d3f6b3) + ```java Port server = Port.parse(this, "www.example.org:8080"); diff --git a/Articles/Code Smells/Code Smell 123 - Mixed 'What' and 'How'/readme.md b/Articles/Code Smells/Code Smell 123 - Mixed 'What' and 'How'/readme.md index 9e21a6ec..4731035d 100644 --- a/Articles/Code Smells/Code Smell 123 - Mixed 'What' and 'How'/readme.md +++ b/Articles/Code Smells/Code Smell 123 - Mixed 'What' and 'How'/readme.md @@ -34,7 +34,7 @@ Choosing wise declarative names is a daily challenge. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/d6d3df14e1268f9308fdd2121ccd598d) + ```javascript class Workflow { @@ -51,7 +51,7 @@ class Workflow { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/4fb3c004b00d81cfb1749bd22394772c) + ```javascript class Workflow { diff --git a/Articles/Code Smells/Code Smell 124 - Divergent Change/readme.md b/Articles/Code Smells/Code Smell 124 - Divergent Change/readme.md index 52ba84e9..dc1e7445 100644 --- a/Articles/Code Smells/Code Smell 124 - Divergent Change/readme.md +++ b/Articles/Code Smells/Code Smell 124 - Divergent Change/readme.md @@ -30,7 +30,7 @@ If an object does too much, it might change in different directions. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/398ed708b96ddabe79971b98edefce4a) + ```javascript class Webpage { @@ -47,7 +47,7 @@ class Webpage { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/cb5736ef2d43863b8cae0ff060c1317a) + ```javascript class Webpage { diff --git a/Articles/Code Smells/Code Smell 125 - 'IS-A' Relationship/readme.md b/Articles/Code Smells/Code Smell 125 - 'IS-A' Relationship/readme.md index c74788c6..2f39c792 100644 --- a/Articles/Code Smells/Code Smell 125 - 'IS-A' Relationship/readme.md +++ b/Articles/Code Smells/Code Smell 125 - 'IS-A' Relationship/readme.md @@ -38,7 +38,7 @@ Behavior is essential, data is [accidental](https://github.com/mcsee/Software-De ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/34677fbac1f6a837bf2b8d17bc882251) + ```java class ComplexNumber { @@ -64,7 +64,7 @@ class RealNumber extends ComplexNumber { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/29e46d1d672ac397552fae978148a7c2) + ```java class Number { diff --git a/Articles/Code Smells/Code Smell 126 - Fake Null Object/readme.md b/Articles/Code Smells/Code Smell 126 - Fake Null Object/readme.md index 4b78185b..89e5ad4a 100644 --- a/Articles/Code Smells/Code Smell 126 - Fake Null Object/readme.md +++ b/Articles/Code Smells/Code Smell 126 - Fake Null Object/readme.md @@ -42,7 +42,7 @@ An empty collection is the collection's null object. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/36ff0b92d6365291ba000de230e3924e) + ```java abstract class Address { @@ -99,7 +99,7 @@ public class RealAddress extends Address { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/baa5c877b821b807ef9c691569a4174d) + ```java // There are just "addresses" diff --git a/Articles/Code Smells/Code Smell 127 - Mutable Constants/readme.md b/Articles/Code Smells/Code Smell 127 - Mutable Constants/readme.md index db79985a..0d3331c1 100644 --- a/Articles/Code Smells/Code Smell 127 - Mutable Constants/readme.md +++ b/Articles/Code Smells/Code Smell 127 - Mutable Constants/readme.md @@ -32,7 +32,7 @@ It is important if it does not mutate. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/3317c6e127e2d8b800174415eb79a08e) + ```javascript const DISCOUNT_PLATINUM = 0.1; @@ -69,7 +69,7 @@ ALL_CONSTANTS.DISCOUNT.PLATINUM = 0.12; // NOT AN ERROR. OOPS! ## Right -[Gist Url]: # (https://gist.github.com/mcsee/e656ae640875909f55bd7eda10b4d227) + ```javascript export const ALL_CONSTANTS = Object.freeze({ diff --git a/Articles/Code Smells/Code Smell 128 - Non English Coding/readme.md b/Articles/Code Smells/Code Smell 128 - Non English Coding/readme.md index 3eb36d2b..0ff6c5d0 100644 --- a/Articles/Code Smells/Code Smell 128 - Non English Coding/readme.md +++ b/Articles/Code Smells/Code Smell 128 - Non English Coding/readme.md @@ -40,7 +40,7 @@ My code (tries to be) in English. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/498a2b777034a67a6725885a20d30c15) + ```javascript const elements = new Set(); @@ -79,7 +79,7 @@ class Person { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/34f1d56858e83e39ebda706a05315454) + ```javascript const elements = new Set(); diff --git a/Articles/Code Smells/Code Smell 129 - Structural Optimizations/readme.md b/Articles/Code Smells/Code Smell 129 - Structural Optimizations/readme.md index 48dd423b..ded557fd 100644 --- a/Articles/Code Smells/Code Smell 129 - Structural Optimizations/readme.md +++ b/Articles/Code Smells/Code Smell 129 - Structural Optimizations/readme.md @@ -40,7 +40,7 @@ We need to surgically improve our code when the facts tell us we have a real iss ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/b8d538891f3b1cf508e984399af004b0) + ```javascript for (k = 0; k < 3 * 3; ++k) { @@ -57,7 +57,7 @@ for (k = 0; k < 3 * 3; ++k) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/b68e67c449b7d0a5b13f69381f02e8e4) + ```javascript for (outerIterator = 0; outerIterator< 3; outerIterator++) { diff --git a/Articles/Code Smells/Code Smell 13 - Empty Constructors/readme.md b/Articles/Code Smells/Code Smell 13 - Empty Constructors/readme.md index 13a1e976..036d06bc 100644 --- a/Articles/Code Smells/Code Smell 13 - Empty Constructors/readme.md +++ b/Articles/Code Smells/Code Smell 13 - Empty Constructors/readme.md @@ -35,7 +35,7 @@ Incomplete objects cause lots of issues.* ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/d9d34fad693fd4f6309d68636a5010e5) + ```javascript class AirTicket { @@ -46,7 +46,7 @@ class AirTicket { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/2e8f884045798f699399bf1ba9c26ab2) + ```javascript class AirTicket { diff --git a/Articles/Code Smells/Code Smell 130 - AddressImpl/readme.md b/Articles/Code Smells/Code Smell 130 - AddressImpl/readme.md index 84ea1a28..3975776b 100644 --- a/Articles/Code Smells/Code Smell 130 - AddressImpl/readme.md +++ b/Articles/Code Smells/Code Smell 130 - AddressImpl/readme.md @@ -26,7 +26,7 @@ We should pick our names carefully. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/f1f4d16d6f90c682f540cd2c0c2cc5f2) + ```java public interface Address extends ChangeAware, Serializable { @@ -44,7 +44,7 @@ public class AddressImpl implements Address { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/6cf15d798176fd83cbe00e207d8351fc) + ```java // Simple diff --git a/Articles/Code Smells/Code Smell 131 - Zero Argument Constructor/readme.md b/Articles/Code Smells/Code Smell 131 - Zero Argument Constructor/readme.md index 438a7638..562023c6 100644 --- a/Articles/Code Smells/Code Smell 131 - Zero Argument Constructor/readme.md +++ b/Articles/Code Smells/Code Smell 131 - Zero Argument Constructor/readme.md @@ -28,7 +28,7 @@ It is common usage using a zero-argument constructor and a bunch of setters to c ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/d42be6d1931e7f4f80781b1360e86a0f) + ```java public Person(); @@ -39,7 +39,7 @@ public Person(); ## Right -[Gist Url]: # (https://gist.github.com/mcsee/af9b6b0a60b76d984cd43b2c26720040) + ```java public Person(String name, int age) { diff --git a/Articles/Code Smells/Code Smell 132 - Exception Try Too Broad/readme.md b/Articles/Code Smells/Code Smell 132 - Exception Try Too Broad/readme.md index bc1618b6..19e6815f 100644 --- a/Articles/Code Smells/Code Smell 132 - Exception Try Too Broad/readme.md +++ b/Articles/Code Smells/Code Smell 132 - Exception Try Too Broad/readme.md @@ -22,7 +22,7 @@ ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/0ff3c46988812be98da1e256b54c00d1) + ```python import calendar, datetime @@ -48,7 +48,7 @@ except ValueError as e: ## Right -[Gist Url]: # (https://gist.github.com/mcsee/0d7e270416ebc934fbfbe8934175e52c) + ```python import calendar, datetime diff --git a/Articles/Code Smells/Code Smell 133 - Hardcoded IF Conditions/readme.md b/Articles/Code Smells/Code Smell 133 - Hardcoded IF Conditions/readme.md index 3e2c6acf..6c0b8070 100644 --- a/Articles/Code Smells/Code Smell 133 - Hardcoded IF Conditions/readme.md +++ b/Articles/Code Smells/Code Smell 133 - Hardcoded IF Conditions/readme.md @@ -28,7 +28,7 @@ We need to clean up stuff. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/894c442e034658ee3a6d602c1dcfcca4) + ```csharp private string FindCountryName (string internetCode) @@ -47,7 +47,7 @@ private string FindCountryName (string internetCode) ## Right -[Gist Url]: # (https://gist.github.com/mcsee/5d45c77d532eb370ca6b78606c0db05e) + ```csharp private string[] country_names = {"Germany", "France", "Argentina"} diff --git a/Articles/Code Smells/Code Smell 134 - Specialized Business Collections/readme.md b/Articles/Code Smells/Code Smell 134 - Specialized Business Collections/readme.md index ad9661bc..d1a54367 100644 --- a/Articles/Code Smells/Code Smell 134 - Specialized Business Collections/readme.md +++ b/Articles/Code Smells/Code Smell 134 - Specialized Business Collections/readme.md @@ -26,7 +26,7 @@ After refining we should remove unneeded abstractions. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/6e4e3684bbb29379a6bf30f4a00a2c7f) + ```php ```php ```java public interface Vehicle { @@ -54,7 +54,7 @@ public class Car implements Vehicle { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/c7c06a683be5fe72d481840c2720e0d5) + ```java public class Car { diff --git a/Articles/Code Smells/Code Smell 136 - Classes With just One Subclass/readme.md b/Articles/Code Smells/Code Smell 136 - Classes With just One Subclass/readme.md index ec2bf1f1..634ae233 100644 --- a/Articles/Code Smells/Code Smell 136 - Classes With just One Subclass/readme.md +++ b/Articles/Code Smells/Code Smell 136 - Classes With just One Subclass/readme.md @@ -34,7 +34,7 @@ Not with interfaces, not with classes. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/ce3cbe785c4b1d542a2b0660acabbc8f) + ```python class Boss(object): @@ -52,7 +52,7 @@ class GoodBoss(Boss): ## Right -[Gist Url]: # (https://gist.github.com/mcsee/441d6bf98d916336dbfa2670d7109640) + ```python class Boss(object): diff --git a/Articles/Code Smells/Code Smell 137 - Inheritance Tree Too Deep/readme.md b/Articles/Code Smells/Code Smell 137 - Inheritance Tree Too Deep/readme.md index f3aecb13..ee47e530 100644 --- a/Articles/Code Smells/Code Smell 137 - Inheritance Tree Too Deep/readme.md +++ b/Articles/Code Smells/Code Smell 137 - Inheritance Tree Too Deep/readme.md @@ -34,7 +34,7 @@ We learned that composition is a more efficient and extensible way to share beha ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/ca80ab1c2443f8494817c027678ab7f3) + ```python class Animalia: @@ -49,7 +49,7 @@ class GreySeal(Halichoerus): ## Right -[Gist Url]: # (https://gist.github.com/mcsee/23622a20da88b3192eb97577557a1f08) + ```python class GreySeal: diff --git a/Articles/Code Smells/Code Smell 138 - Packages Dependency/readme.md b/Articles/Code Smells/Code Smell 138 - Packages Dependency/readme.md index cf37798b..1d61ea04 100644 --- a/Articles/Code Smells/Code Smell 138 - Packages Dependency/readme.md +++ b/Articles/Code Smells/Code Smell 138 - Packages Dependency/readme.md @@ -32,7 +32,7 @@ This introduces coupling into our designs and architectural solutions. ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/32a73793d00fc672138e1a98bbdc9aa8) + ```javascript $ npm install --save is-odd @@ -48,7 +48,7 @@ module.exports = function isOdd(value) { ## Right -[Gist Url]: # (https://gist.github.com/mcsee/751b57a8178500e9143ea2081237ffaf) + ```javascript function isOdd(value) { diff --git a/Articles/Code Smells/Code Smell 139 - Business Code in the User Interface/readme.md b/Articles/Code Smells/Code Smell 139 - Business Code in the User Interface/readme.md index c295b203..2b96114c 100644 --- a/Articles/Code Smells/Code Smell 139 - Business Code in the User Interface/readme.md +++ b/Articles/Code Smells/Code Smell 139 - Business Code in the User Interface/readme.md @@ -36,7 +36,7 @@ We need to validate objects on the back-end and send good validation errors to c ## Wrong -[Gist Url]: # (https://gist.github.com/mcsee/213101392f85e7b9b06727204c84abe1) + ```javascript