Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cool, but Useless

Avatar for Pal Monoczki Pal Monoczki
April 30, 2019
9

Cool, but Useless

Avatar for Pal Monoczki

Pal Monoczki

April 30, 2019

Transcript

  1. The world has changed 420K Code Line 5 Bug /

    11 versions 850 $ / Code Line Started on 1969 54K Person Hour / Year 25 bn $
  2. Pay your Technical Debt Technical debt are activities (like refactoring,

    upgrading a library, conforming to some UI or coding standard, ...) that you’ve left undone, these will hamper your progress if left undone for a longer time
  3. It turns out that style matters in programming for the

    same reason that it matters in writing. It makes for better reading. Douglas Crockford JavaScript: The Good
  4. public class RecentlyUsedList { private List<string> items; public RecentlyUsedList() {

    items = new List<string>(); } public void Add(string newItem) { if (items.Contains(newItem)) { int position = items.IndexOf(newItem); string existingItem = items[position]; items.RemoveAt(position); items.Insert(0, existingItem); } else { items.Insert(0, newItem); } } public int Count { get { int size = items.Count; return size; } } public string this[int index] { get { int position = 0; foreach (string item in items) { if (position == index) return item; ++position; } throw new
  5. public class RecentlyUsedList { private List<string> items; public RecentlyUsedList() {

    items = new List<string>(); } public void Add(string newItem) { if (items.Contains(newItem)) { int position = items.IndexOf(newItem); string existingItem = list[position]; items.RemoveAt(position); items.Insert(0, existingItem); } else { items.Insert(0, newItem); } } public int Count { get { int size = items.Count; return size; } } public string this[int index] { get { int position = 0; foreach (string value in items) { if (position == index) return value; ++position; } throw new public class RecentlyUsedList { private List<string> items = new List<string>(); public void Add(string newItem) { items.Remove(newItem ); items.Add(newItem); } public int Count { get { return items.Count; } } public string this[int index] { get { return items[Count - index - 1]; } } }
  6. Comments A delicate matter, requiring taste and judgement. I tend

    to err on the side of eliminating comments, for several reasons. First, if the code is clear, and uses good type names and variable names, it should explain itself. Second, comments aren't checked by the compiler, so there is no guarantee they're right, especially after the code is modified. A misleading comment can be very confusing. Third, the issue of typography: comments clutter code. Rob Pike, "Notes on Programming in C"
  7. There is a famously bad comment style: i=i+1; /* Add

    one to i */ and there are worse ways to do it: / ********************************** Add one to i * * * * * * ********************************** / i=i+1; Don't laugh now, wait until you see it in real life. Rob Pike, "Notes on Programming in C"
  8. A common fallacy is to assume authors of incomprehensible code

    will somehow be able to express themselves lucidly and clearly in comments.
  9. Continuing existence or cessation of existence: those are the more

    empow to work towa accommodat downsizings outcomes of circumstanc a greater enh the bottom l forwards to a our current d by making a opposition, t demise?
  10. To answer the question "What is clean design?" most succinctly:

    a clean design is one that supports visual thinking so people can meet their informational needs with a minimum of conscious effort.
  11. public ResultType arbitraryMethodName(FirstArgumentType firs SecondArgumentType sec ThirdArgumentType thir LocalVariableType localVariable

    = method(firstArgument, secondArgument) if (localVariable.isSomething(thirdArgument, SOME_SHOUTY_CONSTANT)) { doSomethingWith(localVariable); } return localVariable.getSomething(); }
  12. public ResultType arbitraryMethodName( FirstArgume ntType firstArgument, SecondArgumentType secondArgument, ThirdArgumentType thirdArgument)

    { LocalVariableType localVariable = method(firstArgument, secondArgument); if (localVariable.isSomething( thirdArgument, SOME_SHOUTY_CONSTANT)) { doSomething(localVariable); } return localVariable.getSomething(); }
  13. XXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXX

    XXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX XX XXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXX XXXXXXXXXXXX
  14. Proxy Service Value create Manager Controller get Factory set Object

    check do enable process disable Exception add validate remove
  15. :;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r

    a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b| sed 's/[^a- z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done