blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit c83ed571fc38cfd6d5136651cb4ba589f6a59d76
parent 3e063de7cf76c971f802c93ca046c6108f216de4
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Fri, 25 Dec 2020 18:51:13 -0600

New post: Get GOing

Diffstat:
Acontent/posts/2020-12-25-get-going.en.md | 20++++++++++++++++++++
Morg/2020.org | 26++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/content/posts/2020-12-25-get-going.en.md b/content/posts/2020-12-25-get-going.en.md
@@ -0,0 +1,20 @@
++++
+title = "Get GOing"
+date = 2020-12-25T18:50:00-06:00
+slug = "get-going"
+draft = false
++++
+
+Yes, I [finished the Advent of Code](https://git.shimmy1996.com/advent-of-code/) this year! Aside from the problems being easier (for me) than 2019, I'm also using Go for this year's challenge and I find it to be particularly suited for this type of endeavor.
+
+This year's puzzles mostly involve string parsing and finding efficient data structures. Majority of the logic flow are pretty straight forward and there's little need for sophisticated algorithms.
+
+For string parsing, languages with regex support would be the way to go. The abundance of parsing related problems means using only basic string manipulation could be rather painful, and I've definitely seen my share of horrible blobs of find/substr/trim.
+
+Great majority of the time, slices and maps are all I needed (to abuse). Go has multiple return values but no tuples, whose usage is largely replaced by either arrays or structs. Versatility of these data structures are actually increased due to the language's encouragement to use constants instead of enums: storing all information as ints opens up the door to some shortcuts and less conversion between types. Surely they don't give you the peace of mind type checked enums provide, but writing short programs does provide the odd walking-on-a-knife-edge (or not-wearing-pants-during-zoom-call) satisfaction.
+
+Imperative programs are easy to write in Go, mostly because of the language's consistency in (or the lack of mixed) paradigms. There's no need to worry about whether we should use an STL algorithm or chaining iterator methods: just write the loop. Reasonable mutability behaviors also helps: whether it's changing a map while looping through it or passing a struct containing a slice to another function, I can get the language to do what I mean without checking the specification line by line.
+
+There's [the ZOI rule](https://en.wikipedia.org/wiki/Zero%5Fone%5Finfinity%5Frule) about how the only reasonable numbers are zero, one, and infinity. Quite a few other languages I know, such as Python, C++, and Rust, all seem to hinge on the extreme ends of the spectrum in pursuit of consistency: everything follows the same rules and users can dictate what the syntax means as much as the base language. Go definitely has more exceptions (without supporting it 😜) and "one" moments: built-in containers are magically generic, their methods can have variable number of return values, and everything else is denied the privilege of being eligible to be iterated over.
+
+While just a quick comparison without touching other traits of Go (say interfaces or goroutines, but you don't really need them for Advent of Code), I do find Go's choices peculiar and interesting: [everything is, well, just its own thing](https://lukeplant.me.uk/blog/posts/everything-is-an-x-pattern/).
diff --git a/org/2020.org b/org/2020.org
@@ -598,3 +598,29 @@ TIReD评分记录的格式为=X=T/I/Re[+D]=。例如:
 问:“TIReD”(以及分项得分名称)是怎么确定的?
 
 答:第一个有具体名称的项目是回味(revisit-ability),后面的大部分时间都花在玩单词排列和缩写上。由于[[https://www.urbandictionary.com/define.php?term=tird][Urban Dictionary]],我差点将这套评分标准命名为“TIRD”。不过,至少不是所有的作品都是*。😜
+* TODO Get GOing
+:PROPERTIES:
+:EXPORT_DATE: 2020-12-25
+:EXPORT_HUGO_SLUG: get-going
+:END:
+
+** DONE en
+CLOSED: [2020-12-25 Fri 18:50]
+:PROPERTIES:
+:EXPORT_FILE_NAME: 2020-12-25-get-going.en.md
+:EXPORT_TITLE: Get GOing
+:END:
+
+Yes, I [[https://git.shimmy1996.com/advent-of-code/][finished the Advent of Code]] this year! Aside from the problems being easier (for me) than 2019, I'm also using Go for this year's challenge and I find it to be particularly suited for this type of endeavor.
+
+This year's puzzles mostly involve string parsing and finding efficient data structures. Majority of the logic flow are pretty straight forward and there's little need for sophisticated algorithms.
+
+For string parsing, languages with regex support would be the way to go. The abundance of parsing related problems means using only basic string manipulation could be rather painful, and I've definitely seen my share of horrible blobs of find/substr/trim.
+
+Great majority of the time, slices and maps are all I needed (to abuse). Go has multiple return values but no tuples, whose usage is largely replaced by either arrays or structs. Versatility of these data structures are actually increased due to the language's encouragement to use constants instead of enums: storing all information as ints opens up the door to some shortcuts and less conversion between types. Surely they don't give you the peace of mind type checked enums provide, but writing short programs does provide the odd walking-on-a-knife-edge (or not-wearing-pants-during-zoom-call) satisfaction.
+
+Imperative programs are easy to write in Go, mostly because of the language's consistency in (or the lack of mixed) paradigms. There's no need to worry about whether we should use an STL algorithm or chaining iterator methods: just write the loop. Reasonable mutability behaviors also helps: whether it's changing a map while looping through it or passing a struct containing a slice to another function, I can get the language to do what I mean without checking the specification line by line.
+
+There's [[https://en.wikipedia.org/wiki/Zero_one_infinity_rule][the ZOI rule]] about how the only reasonable numbers are zero, one, and infinity. Quite a few other languages I know, such as Python, C++, and Rust, all seem to hinge on the extreme ends of the spectrum in pursuit of consistency: everything follows the same rules and users can dictate what the syntax means as much as the base language. Go definitely has more exceptions (without supporting it 😜) and "one" moments: built-in containers are magically generic, their methods can have variable number of return values, and everything else is denied the privilege of being eligible to be iterated over.
+
+While just a quick comparison without touching other traits of Go (say interfaces or goroutines, but you don't really need them for Advent of Code), I do find Go's choices peculiar and interesting: [[https://lukeplant.me.uk/blog/posts/everything-is-an-x-pattern/][everything is, well, just its own thing]].