From 8707104f1d5c81d1b52bf1c3a88556b420216075 Mon Sep 17 00:00:00 2001 From: Cadin McQueen Date: Wed, 27 Mar 2019 19:56:03 -0400 Subject: [PATCH 1/2] Completed HTML/CSS & JS 'WhatWouldYouChange' tests --- html-css/WhatWouldYouChange/test.html | 34 +++++++++- javascript/WhatWouldYouChange/test.html | 86 +++++++++++++------------ 2 files changed, 77 insertions(+), 43 deletions(-) diff --git a/html-css/WhatWouldYouChange/test.html b/html-css/WhatWouldYouChange/test.html index 62e45f11..a35c97a5 100644 --- a/html-css/WhatWouldYouChange/test.html +++ b/html-css/WhatWouldYouChange/test.html @@ -21,12 +21,42 @@ Bonus point for the correct use of the word "semantic" in an answer. --> -
+ + + + +

HTML & CSS test

+ +
+ + + +
+ +

Select your favorite javascript framework:
+ + + + +
+ + + +
+ + + +
+ + + +

+
\ No newline at end of file diff --git a/javascript/WhatWouldYouChange/test.html b/javascript/WhatWouldYouChange/test.html index 9464e8a5..b1221482 100644 --- a/javascript/WhatWouldYouChange/test.html +++ b/javascript/WhatWouldYouChange/test.html @@ -1,47 +1,8 @@ - -JavaScript test: What would you change? - - - + + JavaScript test: What would you change? @@ -50,5 +11,48 @@

+ + + + + + + \ No newline at end of file From 6660a6b102dd3fd86cf6ca2aa55a9b7ffd8d6600 Mon Sep 17 00:00:00 2001 From: Cadin McQueen Date: Sun, 7 Apr 2019 14:09:40 -0400 Subject: [PATCH 2/2] Completed dot-net 'WhatWouldYouChange' test --- dot-net/WhatWouldYouChange/INSTRUCTIONS.txt | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dot-net/WhatWouldYouChange/INSTRUCTIONS.txt b/dot-net/WhatWouldYouChange/INSTRUCTIONS.txt index be2263d6..8415f9a1 100644 --- a/dot-net/WhatWouldYouChange/INSTRUCTIONS.txt +++ b/dot-net/WhatWouldYouChange/INSTRUCTIONS.txt @@ -5,4 +5,24 @@ Suggested Changes: - \ No newline at end of file + `public string exampleText` maintains proper encapsulation using the `{ get; set; }` auto-properties, which is great! Originally, I was concerned that it was set to `public`, but I just learned about these auto-properties today. + + In `ExampleMethod`, `var text = ""` should be declared with a type; in this instance, it should be `string text = ""` because we are always expecting it to be a string. + + A StreamReader can be passed the txt file directly via the `exampleTextFile` parameter, so we don't need the `fs` variable. + + The StreamReader should use a `using` statement so that even if an exception occurs, Dispose will still be called. + + `catch` should really only be used for error handling. If we want to assign some default value if the operation fails, then that functionality should be captured in a condition check. There can be multiple reasons why an operation would fail and enter the `catch` block, and we might not necessarily always want the same thing to happen no matter how it fails. + + As written, the construction of the "default" `text` variable inside of the `catch` block uses far more momory than it needs to since it is going through many reassignments. If the new lines are necessary, we can build up the `text` variable with the default "lorem ipsum" text using a StringBuilder and leverage `.AppendLine()` to be more efficient. + + If the new lines are *not* necessary, then we can use simple string concatenation and break it into multiple lines in our editor instead of reassigning the `text` variable over and over. Example: + text = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + + "Duis non pulvinar sapien, nec accumsan justo. " + + "etc." + + When reassigning `exampleText`, we should use `this.exampleText` to properly reference it inside the class. + + In `Program.cs`, `ExampleMethod` is being called with a string rather than a path to a valid .txt file. In this scenario, if we wanted to call the method with the `ExampleText.txt` file in the same directory, then it would need a valid file extension (ie. `ExampleTexttxt` !== `ExampleText.txt`). \ No newline at end of file