From e47ab0804ec51717a9d8d4b99ba9558e433bdbb0 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Sat, 11 Jun 2022 12:56:02 -0500 Subject: [PATCH] Update a ton of styles I guess and do other stuff too, I dunno, WIP --- public/{fishbowl.css => fishbowl-dark.css} | 6 +- public/fishbowl-light.css | 625 + public/waterline.svg | 7 + src/hmnurl/urls.go | 8 +- src/templates/src/fishbowl.html | 44 +- src/templates/src/fishbowls/README.md | 6 +- src/templates/src/fishbowls/oop/OOP.html | 778 -- src/templates/src/fishbowls/oop/index.html | 12271 ------------------- src/templates/src/include/header.html | 2 +- src/templates/src/landing.html | 4 +- src/templates/src/wheeljam_index.html | 4 +- src/templates/types.go | 1 - src/website/fishbowl.go | 122 +- 13 files changed, 794 insertions(+), 13084 deletions(-) rename public/{fishbowl.css => fishbowl-dark.css} (94%) create mode 100644 public/fishbowl-light.css create mode 100644 public/waterline.svg delete mode 100644 src/templates/src/fishbowls/oop/index.html diff --git a/public/fishbowl.css b/public/fishbowl-dark.css similarity index 94% rename from public/fishbowl.css rename to public/fishbowl-dark.css index 2a28c90..677ff1d 100644 --- a/public/fishbowl.css +++ b/public/fishbowl-dark.css @@ -2,9 +2,8 @@ background-color: #36393e; color: #dcddde; font-family: Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 17px; + font-size: 1rem; font-weight: 400; - border-radius: 3px; } .fishbowl a { @@ -115,7 +114,8 @@ .fishbowl .chatlog__short-timestamp { display: none; color: #a3a6aa; - font-size: 0.75rem; + font-size: 0.7em; + line-height: 1.4em; font-weight: 500; direction: ltr; unicode-bidi: bidi-override; diff --git a/public/fishbowl-light.css b/public/fishbowl-light.css new file mode 100644 index 0000000..29b8e9d --- /dev/null +++ b/public/fishbowl-light.css @@ -0,0 +1,625 @@ +.fishbowl { + background-color: #ffffff; + color: #23262a; + font-family: Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 1rem; + font-weight: 500; + border: 1px solid #ddd; +} + +.fishbowl a { + color: #0068e0; + text-decoration: none; +} + +.fishbowl a:hover { + text-decoration: underline; +} + +.fishbowl img { + object-fit: contain; + image-rendering: high-quality; + image-rendering: -webkit-optimize-contrast; +} + +.fishbowl .preamble { + display: grid; + grid-template-columns: auto 1fr; + max-width: 100%; + padding: 1rem; +} + +.fishbowl .preamble__guild-icon-container { + grid-column: 1; +} + +.fishbowl .preamble__guild-icon { + max-width: 88px; + max-height: 88px; +} + +.fishbowl .preamble__entries-container { + grid-column: 2; + margin-left: 1rem; +} + +.fishbowl .preamble__entry { + margin-bottom: 0.15rem; + color: #2f3136; + font-size: 1.4rem; +} + +.fishbowl .preamble__entry--small { + font-size: 1rem; +} + +.fishbowl .chatlog { + padding: 1rem 0; + width: 100%; +} + +.fishbowl .chatlog__message-group { + margin-bottom: 1rem; +} + +.fishbowl .chatlog__message-container { + background-color: transparent; + transition: background-color 1s ease; +} + +.fishbowl .chatlog__message-container--highlighted { + background-color: rgba(114, 137, 218, 0.2); +} + +.fishbowl .chatlog__message-container--pinned { + background-color: rgba(249, 168, 37, 0.05); +} + +.fishbowl .chatlog__message { + display: grid; + grid-template-columns: auto 1fr; + padding: 0.15rem 0; + direction: ltr; + unicode-bidi: bidi-override; +} + +.fishbowl .chatlog__message:hover { + background-color: #fafafa; +} + +.fishbowl .chatlog__message:hover .chatlog__short-timestamp { + display: block; +} + +.fishbowl .chatlog__message-aside { + grid-column: 1; + width: 72px; + padding: 0.15rem 0.15rem 0 0.15rem; + text-align: center; +} + +.fishbowl .chatlog__reference-symbol { + height: 10px; + margin: 6px 4px 4px 36px; + border-left: 2px solid #c7ccd1; + border-top: 2px solid #c7ccd1; + border-radius: 8px 0 0 0; +} + +.fishbowl .chatlog__avatar { + width: 40px; + height: 40px; + border-radius: 50%; +} + +.fishbowl .chatlog__short-timestamp { + display: none; + color: #5e6772; + font-size: 0.7em; + line-height: 1.4em; + font-weight: 500; + direction: ltr; + unicode-bidi: bidi-override; +} + +.fishbowl .chatlog__message-primary { + grid-column: 2; + min-width: 0; +} + +.fishbowl .chatlog__reference { + display: flex; + margin-bottom: 0.15rem; + align-items: center; + color: #5f5f60; + font-size: 0.875rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.fishbowl .chatlog__reference-avatar { + width: 16px; + height: 16px; + margin-right: 0.25rem; + border-radius: 50%; +} + +.fishbowl .chatlog__reference-author { + margin-right: 0.3rem; + font-weight: 600; +} + +.fishbowl .chatlog__reference-content { + overflow: hidden; + text-overflow: ellipsis; +} + +.fishbowl .chatlog__reference-link { + cursor: pointer; +} + +.fishbowl .chatlog__reference-link * { + display: inline; + pointer-events: none; +} + +.fishbowl .chatlog__reference-link .hljs { + display: inline; +} + +.fishbowl .chatlog__reference-link:hover { + color: #2f3136; +} + +.fishbowl .chatlog__reference-link:hover *:not(.chatlog__markdown-spoiler) { + color: inherit; +} + +.fishbowl .chatlog__reference-edited-timestamp { + margin-left: 0.25rem; + color: #5e6772; + font-size: 0.75rem; + font-weight: 500; + direction: ltr; + unicode-bidi: bidi-override; +} + +.fishbowl .chatlog__header { + margin-bottom: 0.1rem; +} + +.fishbowl .chatlog__author { + font-weight: 600; + color: #2f3136; +} + +.fishbowl .chatlog__bot-label { + position: relative; + top: -0.1rem; + margin-left: 0.3rem; + padding: 0.05rem 0.3rem; + border-radius: 3px; + background-color: #5865F2; + color: #ffffff; + font-size: 0.625rem; + font-weight: 500; + line-height: 1.3; +} + +.fishbowl .chatlog__timestamp { + margin-left: 0.3rem; + color: #5e6772; + font-size: 0.75rem; + font-weight: 500; + direction: ltr; + unicode-bidi: bidi-override; +} + +.fishbowl .chatlog__content { + padding-right: 1rem; + font-size: 0.95rem; + word-wrap: break-word; +} + +.fishbowl .chatlog__edited-timestamp { + margin-left: 0.15rem; + color: #5e6772; + font-size: 0.75rem; + font-weight: 500; +} + +.fishbowl .chatlog__attachment { + position: relative; + width: fit-content; + margin-top: 0.3rem; + border-radius: 3px; + overflow: hidden; +} + +.fishbowl .chatlog__attachment--hidden { + cursor: pointer; + box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1); +} + +.fishbowl .chatlog__attachment--hidden * { + pointer-events: none; +} + +.fishbowl .chatlog__attachment-spoiler-caption { + display: none; + position: absolute; + left: 50%; + top: 50%; + z-index: 999; + padding: 0.4rem 0.8rem; + border-radius: 20px; + transform: translate(-50%, -50%); + background-color: rgba(0, 0, 0, 0.9); + color: #dcddde; + font-size: 0.9rem; + font-weight: 600; + letter-spacing: 0.05rem; +} + +.fishbowl .chatlog__attachment--hidden .chatlog__attachment-spoiler-caption { + display: block; +} + +.fishbowl .chatlog__attachment--hidden:hover .chatlog__attachment-spoiler-caption { + color: #fff; +} + +.fishbowl .chatlog__attachment-media { + max-width: 45vw; + max-height: 500px; + vertical-align: top; + border-radius: 3px; +} + +.fishbowl .chatlog__attachment--hidden .chatlog__attachment-media { + filter: blur(44px); +} + +.fishbowl .chatlog__attachment-generic { + max-width: 520px; + width: 100%; + height: 40px; + padding: 10px; + border: 1px solid #ebedef; + border-radius: 3px; + background-color: #f2f3f5; + overflow: hidden; +} + +.fishbowl .chatlog__attachment--hidden .chatlog__attachment-generic { + filter: blur(44px); +} + +.fishbowl .chatlog__attachment-generic-icon { + float: left; + width: 30px; + height: 100%; + margin-right: 10px; +} + +.fishbowl .chatlog__attachment-generic-size { + color: #72767d; + font-size: 12px; +} + +.fishbowl .chatlog__attachment-generic-name { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.fishbowl .chatlog__embed { + display: flex; + margin-top: 0.3rem; + max-width: 520px; +} + +.fishbowl .chatlog__embed-color-pill { + flex-shrink: 0; + width: 0.25rem; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +.fishbowl .chatlog__embed-color-pill--default { + background-color: rgba(227, 229, 232, 1); +} + +.fishbowl .chatlog__embed-content-container { + display: flex; + flex-direction: column; + padding: 0.5rem 0.6rem; + border: 1px solid rgba(204, 204, 204, 0.3); + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + background-color: rgba(249, 249, 249, 0.3); +} + +.fishbowl .chatlog__embed-content { + display: flex; + width: 100%; +} + +.fishbowl .chatlog__embed-text { + flex: 1; +} + +.fishbowl .chatlog__embed-author-container { + display: flex; + margin-bottom: 0.5rem; + align-items: center; +} + +.fishbowl .chatlog__embed-author-icon { + width: 20px; + height: 20px; + margin-right: 0.5rem; + border-radius: 50%; +} + +.fishbowl .chatlog__embed-author { + color: #4f545c; + font-size: 0.875rem; + font-weight: 600; + direction: ltr; + unicode-bidi: bidi-override; +} + +.fishbowl .chatlog__embed-author-link { + color: #4f545c; +} + +.fishbowl .chatlog__embed-title { + margin-bottom: 0.5rem; + color: #4f545c; + font-size: 0.875rem; + font-weight: 600; +} + +.fishbowl .chatlog__embed-description { + color: #2e3338; + font-weight: 500; + font-size: 0.85rem; +} + +.fishbowl .chatlog__embed-fields { + display: flex; + flex-wrap: wrap; + gap: 0 0.5rem; +} + +.fishbowl .chatlog__embed-field { + flex: 0; + min-width: 100%; + max-width: 506px; + padding-top: 0.6rem; + font-size: 0.875rem; +} + +.fishbowl .chatlog__embed-field--inline { + flex: 1; + flex-basis: auto; + min-width: 50px; +} + +.fishbowl .chatlog__embed-field-name { + margin-bottom: 0.2rem; + color: #36393e; + font-weight: 600; +} + +.fishbowl .chatlog__embed-field-value { + color: #2e3338; + font-weight: 500; +} + +.fishbowl .chatlog__embed-thumbnail { + flex: 0; + max-width: 80px; + max-height: 80px; + margin-left: 1.2rem; + border-radius: 3px; +} + +.fishbowl .chatlog__embed-image-container { + margin-top: 0.6rem; +} + +.fishbowl .chatlog__embed-image { + max-width: 500px; + max-height: 400px; + border-radius: 3px; +} + +.fishbowl .chatlog__embed-footer { + margin-top: 0.6rem; + color: #2e3338; +} + +.fishbowl .chatlog__embed-footer-icon { + width: 20px; + height: 20px; + margin-right: 0.2rem; + border-radius: 50%; + vertical-align: middle; +} + +.fishbowl .chatlog__embed-footer-text { + vertical-align: middle; + font-size: 0.75rem; + font-weight: 500; +} + +.fishbowl .chatlog__embed-plainimage { + max-width: 45vw; + max-height: 500px; + vertical-align: top; + border-radius: 3px; +} + +.fishbowl .chatlog__embed-spotify { + border: 0; +} + +.fishbowl .chatlog__embed-youtube-container { + margin-top: 0.6rem; +} + +.fishbowl .chatlog__embed-youtube { + border: 0; + border-radius: 3px; +} + +.fishbowl .chatlog__sticker { + width: 180px; + height: 180px; +} + +.fishbowl .chatlog__sticker--media { + max-width: 100%; + max-height: 100%; +} + +.fishbowl .chatlog__reactions { + display: flex; +} + +.fishbowl .chatlog__reaction { + display: flex; + margin: 0.35rem 0.1rem 0.1rem 0; + padding: 0.125rem 0.375rem; + border: 1px solid transparent; + border-radius: 8px; + background-color: #f2f3f5; + align-items: center; +} + +.fishbowl .chatlog__reaction:hover { + border: 1px solid rgba(0, 0, 0, 0.2); + background-color: white; +} + +.fishbowl .chatlog__reaction-count { + min-width: 9px; + margin-left: 0.35rem; + color: #4f5660; + font-size: 0.875rem; +} + +.fishbowl .chatlog__reaction:hover .chatlog__reaction-count { + color: #2e3338; +} + +.fishbowl .chatlog__markdown { + max-width: 100%; + line-height: 1.3; + overflow-wrap: break-word; +} + +.fishbowl .chatlog__markdown-preserve { + white-space: pre-wrap; +} + +.fishbowl .chatlog__markdown-spoiler { + background-color: rgba(0, 0, 0, 0.1); + border-radius: 3px; +} + +.fishbowl .chatlog__markdown-spoiler--hidden { + cursor: pointer; + background-color: #b9bbbe; + color: rgba(0, 0, 0, 0); +} + +.fishbowl .chatlog__markdown-spoiler--hidden:hover { + background-color: rgba(185, 187, 190, 0.8); +} + +.fishbowl .chatlog__markdown-spoiler--hidden::selection { + color: rgba(0, 0, 0, 0); +} + +.fishbowl .chatlog__markdown-quote { + display: flex; + margin: 0.05rem 0; +} + +.fishbowl .chatlog__markdown-quote-border { + margin-right: 0.5rem; + border: 2px solid #c7ccd1; + border-radius: 3px; +} + +.fishbowl .chatlog__markdown-pre { + background-color: #f9f9f9; + font-family: "Consolas", "Courier New", Courier, monospace; +} + +.fishbowl .chatlog__markdown-pre--multiline { + margin-top: 0.25rem; + padding: 0.5rem; + border: 2px solid #f3f3f3; + border-radius: 5px; + color: #657b83; +} + +.fishbowl .chatlog__markdown-pre--multiline.hljs { + background-color: inherit; + color: inherit; +} + +.fishbowl .chatlog__markdown-pre--inline { + padding: 2px; + border-radius: 3px; + font-size: 0.85rem; +} + +.fishbowl .chatlog__markdown-mention { + border-radius: 3px; + padding: 0 2px; + background-color: rgba(88, 101, 242, .15); + color: #505cdc; + font-weight: 500; +} + +.fishbowl .chatlog__markdown-mention:hover { + background-color: #5865f2; + color: #ffffff +} + +.fishbowl .chatlog__markdown-timestamp { + border-radius: 3px; + padding: 0 2px; + color: #5e6772; +} + +.fishbowl .chatlog__emoji { + width: 1.325rem; + height: 1.325rem; + margin: 0 0.06rem; + vertical-align: -0.4rem; +} + +.fishbowl .chatlog__emoji--small { + width: 1rem; + height: 1rem; +} + +.fishbowl .chatlog__emoji--large { + width: 2.8rem; + height: 2.8rem; +} + +.fishbowl .postamble { + padding: 1.25rem; +} + +.fishbowl .postamble__entry { + color: #2f3136; +} \ No newline at end of file diff --git a/public/waterline.svg b/public/waterline.svg new file mode 100644 index 0000000..8b98936 --- /dev/null +++ b/public/waterline.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/hmnurl/urls.go b/src/hmnurl/urls.go index 01b27ae..460ba3f 100644 --- a/src/hmnurl/urls.go +++ b/src/hmnurl/urls.go @@ -376,14 +376,14 @@ func BuildFishbowlIndex() string { return Url("/fishbowl", nil) } -var RegexFishbowl = regexp.MustCompile(`^/fishbowl/(?P[^/]+)$`) +var RegexFishbowl = regexp.MustCompile(`^/fishbowl/(?P[^/]+)/?$`) -func BuildFishbowl(name string) string { +func BuildFishbowl(slug string) string { defer CatchPanic() - return Url(fmt.Sprintf("/fishbowl/%s", name), nil) + return Url(fmt.Sprintf("/fishbowl/%s/", slug), nil) } -var RegexFishbowlFiles = regexp.MustCompile(`^/fishbowl/(?P[^/]+)(?P/.+)$`) +var RegexFishbowlFiles = regexp.MustCompile(`^/fishbowl/(?P[^/]+)(?P/.+)$`) /* * Forums diff --git a/src/templates/src/fishbowl.html b/src/templates/src/fishbowl.html index b10d510..ed7707e 100644 --- a/src/templates/src/fishbowl.html +++ b/src/templates/src/fishbowl.html @@ -2,7 +2,7 @@ {{ define "extrahead" }} - + + + {{ end }} {{ define "content" }} -
- {{- .Contents -}} +
+

{{ .Info.Title }}

+ +
+
+ This is a fishbowl: a panel conversation held on the Handmade Network Discord where a select few participants discuss a topic with depth and nuance. We host them every two months, so if you want to catch the next one, join the Discord! +
+
+ +
+ {{- .Contents -}} +
{{ end }} diff --git a/src/templates/src/fishbowls/README.md b/src/templates/src/fishbowls/README.md index bb1fd07..7e22d74 100644 --- a/src/templates/src/fishbowls/README.md +++ b/src/templates/src/fishbowls/README.md @@ -1,5 +1 @@ -# Folder structure - -One folder per fishbowl. It will look for an index.html file to be dumped directly into the page. All other files / directories are to be served as static files. - -The fishbowl folder name will be used as the URL slug. This is important because the folder name is used for routing to static files. +Make sure to name these folders according to the URL slugs of the fishbowls. Otherwise, static files for fishbowls will not work. diff --git a/src/templates/src/fishbowls/oop/OOP.html b/src/templates/src/fishbowls/oop/OOP.html index 6f709a2..31817de 100644 --- a/src/templates/src/fishbowls/oop/OOP.html +++ b/src/templates/src/fishbowls/oop/OOP.html @@ -1,756 +1,3 @@ - - - Handmade Network - What, if anything, is OOP? - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Guild icon -
-
-
Handmade Network
-
fishbowl / What, if anything, is OOP?
- - -
-
-
@@ -780,21 +27,6 @@ 28-May-22 09:58 AM
- - - - -
- - -
-
-
-
09:58
-
- -
-
Welcome to yet another fishbowl, everyone! Just setting things up here. The main conversation is here in this thread, and the #fishbowl-audience conversation starts here: https://discord.com/channels/239737791225790464/708458209131757598/980155512412864552 @@ -805,7 +37,6 @@ The pinned messages are some "checkpoints" in the discussion; chapter markers of -
@@ -13038,12 +12269,3 @@ Are the same as mine
- -
-
Exported 463 message(s)
-
- - - - - \ No newline at end of file diff --git a/src/templates/src/fishbowls/oop/index.html b/src/templates/src/fishbowls/oop/index.html deleted file mode 100644 index 31817de..0000000 --- a/src/templates/src/fishbowls/oop/index.html +++ /dev/null @@ -1,12271 +0,0 @@ -
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Topic: What, if anything, is OOP? - -
-
-
- bvisness - - - 28-May-22 09:58 AM -
- -
- Welcome to yet another fishbowl, everyone! Just setting things up here. The main conversation is here in this thread, and the #fishbowl-audience conversation starts here: https://discord.com/channels/239737791225790464/708458209131757598/980155512412864552 - -The pinned messages are some "checkpoints" in the discussion; chapter markers of sorts. Check them out if there's a specific aspect of the discussion you'd like to see. - - (edited) -
- - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 09:59 AM -
- -
- Welcome, everyone! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:00 AM -
- -
- Hi! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:01 AM -
- -
- So, this fishbowl is a long time coming. Since the dawn of the network, many people have asked the question: Is object-oriented programming bad, or what? - -
- - - - -
-
- 💥 - 4 -
-
-
-
-
-
-
-
-
10:02
-
- -
- -
- That is, unfortunately, not a very nuanced question. 🙂 - -
- - - - -
-
-
-
-
-
-
10:02
-
- -
- -
- Our conversations about OOP often veer in a lot of different directions, and the subject is hard to discuss productively because it means so many different things to different people. - -
- - - - -
-
-
-
-
-
-
10:04
-
- -
- -
- There are many different ideas that are bundled into the modern concept of "object-oriented programming". There are also many languages that have taken on these ideas with different decisions and tradeoffs. Our goal in this fishbowl is to break this subject down and discuss these different concepts with more nuance. - -
- - - - -
-
-
-
-
-
-
10:04
-
- -
- -
- To that end, we're doing things just a little bit differently for this one. Each of our esteemed participants have picked a particular aspect of "OOP" to present, and we'll be working through those over the course of the conversation here. - -
- - - - -
-
-
-
-
-
-
10:04
-
- -
- -
- On that note, let me introduce our participants: - -
- - - - -
-
-
-
-
-
-
10:05
-
- -
- -
- - me (hi) - -
- - - - -
-
-
-
-
-
-
10:05
-
- -
- -
- - @demetrispanos, general wise elder of the community with particular expertise in machine learning and artificial intelligence - -
- - - - -
-
-
-
-
-
-
10:06
-
- -
- -
- - @gingerBill, creator of the Odin programming language - -
- - - - -
-
-
-
-
-
-
10:07
-
- -
- -
- - @Kartik Agaram, creator of creative and very low-level programming systems / operating systems such as Mu and Teliva (look them up!) - -
- - - - -
-
-
-
-
-
-
10:08
-
- -
- -
- - @SirWhinesalot, a community member whose comments were instrumental to the planning process for this fishbowl (if there are projects you've worked on that I'm not aware of, let me know and I'll update this introduction 😅) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:08 AM -
- -
- none public 🙂 - -
- - - - -
-
-
-
-
-
-
10:08
-
- -
- -
- but my expertise is in Domain-Specific Languages and Constraint Solving - -
- - - - -
-
- ❗ - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:08 AM -
- -
- 👍 - -
- - - - -
-
-
-
-
-
-
10:09
-
- -
- -
- Before we get into the various modern conceptions of OOP, I think it would be good to take a look back at the history of object-oriented programming, and the path that we took to get to where we are today. @Kartik Agaram has graciously volunteered to walk us through that history, so - take it away, Kartik! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:10 AM -
- -
- Is this thing on? Ok, let me paste in some prepared remarks. A quick, opinionated timeline of the major ideas that make up OO. - -
- - - - -
-
-
-
-
-
-
10:10
-
- -
- -
- 1958-1966: A few different people gradually come up with the notion of structured data. Conventions for managing compound data made of multiple words in memory. If you have two points, you want their x and y coordinates close together and in the same relative order. Seems obvious, but wasn't! See http://akkartik.name/sketchpad-oo.png from the Sketchpad thesis [1]. - -1960-1962: Ivan Sutherland works on Sketchpad. It presages many OO ideas, but they're all in the programmer's mind and prose (thesis) because the code is all machine code. - -1961-1962: Simula provides language support for many OO ideas: objects, classes, inheritance, dispatch based on the precise class of an object (virtual methods).[2] - -1960-1975: Data first. This was mostly a mindset thing, but led eventually to notation like obj.method. Had spread fairly wide by around 1975, when Fred Brooks said, "show me your code and I'll be mystified. Show me your data structures and the code will be obvious." [3] - -1973-1975: Abstract data types by Barbara Liskov. Ignore internal details of how objects are laid out in memory. Focus instead on a small vocabulary of operations that can be performed using them. Interfaces, basically.[4] - -1966-1975: Alan Kay coins OO after working on Smalltalk. (The first chapter of http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html is better than my history above.) "Did not have C++ in mind." However, we're only halfway done. - - (edited) -
- - -
- - Embedded image - -
- - -
-
-
-
-
-
-
10:11
-
- -
- -
- 1970-1975: Lexical scope comes into its own, and leads naturally to closures.[5] - -1980-1994: Lisp has been evolving largely in parallel, but now starts to cross-pollinate with OO. MIT Flavors (1982), CommonLOOPS (1986), CLOS (1994). OO is big on late binding. Lisp takes late binding to 11, with before/after advice and dispatch based on the types of multiple arguments. In 1994, Common Lisp decides to adopt lexical scope by default. - -1992: It becomes clear that there's a yin-yang duality between objects and closures.[6] Though objects have the benefit of putting data first. - -1994: The "gang of four" writes the Design Patterns book, based on ideas by the architect Christopher Alexander. Kicks off the field of OO design. - -2001: Joel Spolsky coins "architecture astronauts,"[7] peak of hype cycle for design patterns. (OO design remains in vogue to this day, though.) - -2007: Clojure arrives. Built on an OO foundation (the JVM) but determinedly anti-OO. Peak of the hype cycle for OO? Functional programming is now ascendant, impelled by the value of immutability. - -2008-2014: Growing anti-OO sentiment[8], anti-design-patterns sentiment[9], awareness that composition is superior to inheritance[10]. - -2020: Richard Feldman crystallizes the case against OO[11]: OO wants to make every object a little computer. But why do we want to make all programs distributed? - -
- - - - -
-
-
- -
-
-
-
10:12
-
- -
- -
- Ok I'm done 🙂 Summary: there's a lot of ideas baked into "OO". Most of them are great. Some of them are showing their age. And unbundling them all feels more useful than treating them monolithically. End prepared remarks 🙂 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:14 AM -
- -
- Excellent, this is a wonderful place to start. I appreciate that you included a lot of the recent takes on OO; I think we'll especially be revisiting a lot of the 2001-present takes as we go along. - -
- - - - -
-
-
-
-
-
-
10:16
-
- -
- -
- For some more context, what languages were in use around the 60s-70s when Brooks said that quote about data structures, and when Liskov was pioneering abstract data types? - -
- - - - -
-
-
-
-
-
-
10:16
-
- -
- -
- In general I'm curious how some of these early ideas manifested in the tools that we now use today. (I know Java was a big one along the way, and we'll have a nice long section dedicated just to that...) - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:18 AM -
- -
- I know CLU (Barbara Liskov's language) came out in 1973 - -
- - - - -
-
-
-
-
-
-
10:18
-
- -
- -
- Interestingly it was the first language with built-in Tagged Unions as far as I know - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:19 AM -
- -
- Oh gosh. I wasn't around then 🙂 but my weak sense is that while there were a few different programming languages being researched, the vast majority of people were programming in machine code and Assembly back then. Big ones: Fortran, COBOL, Algol (still getting refined), Lisp 1.5. - -
- - - - -
-
-
-
-
-
-
10:20
-
- -
- -
- @SirWhinesalot Yes, I think so! Too bad it took so long for them to go "mainstream". - -
- - - - -
-
-
-
-
-
-
10:21
-
- -
- -
- Going back to that Brooks quote. I think he was mostly talking about how programmers communicate. Languages and compilers weren't really the dominant gatekeepers of notation back then. - -
- - - - -
-
-
-
-
-
-
10:21
-
- -
- -
- It was paper, in some form. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:21 AM -
- -
- That makes sense, I suppose that would be the case - -
- - - - -
-
-
-
-
-
-
10:22
-
- -
- -
- The sense that I get (which may not be very accurate) is that in the 60s and 70s, there was a lot of pioneering work in the field happening mostly in parallel, but that the ideas hadn't really taken hold in "industry" yet. At what point would you say that began to occur? - - (edited) -
- - - - -
-
-
-
-
-
-
10:22
-
- -
- -
- Certainly from what I've seen of e.g. FORTRAN, the "practical tools" of the day didn't have any such concepts. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:25 AM -
- -
- That's a good question. I have a hard time thinking of descriptions of production systems and languages used by industry. Even though Bell Labs and PARC came from industry, I think a lot of their work was fed by govt. grants and so tightly coupled with govt. rather than commercial considerations. - -The software industry took off around late 70s? And then it took a while to rediscover the value of programming languages as the PC revolution took off and computers got fast enough to manage HLLs. - -
- - - - -
-
-
-
-
-
-
10:25
-
- -
- -
- Turbo Pascal was 1983. That was really my introduction to high-level languages. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:26 AM -
- -
- I know @gingerBill is quite a Pascal fan; I don't know if he would know any more about the history there - -
- - - - -
-
-
-
-
-
-
10:26
-
- -
- -
- or at least a Wirth fan 🙂 - -
- - - - -
-
- ❤️ - 3 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:27 AM -
- -
- The first Pascal was created by Niklaus Wirth in 1970 as a teaching tool. - -
- - - - -
-
-
-
-
-
-
10:27
-
- -
- -
- It mostly became popular because of its simplicity and that it was easy to learn, especially amongst many of the minicomputer buyers in the 1970s. - -
- - - - -
-
-
-
-
-
-
10:28
-
- -
- -
- Pascal (along with C) are part of a language family called ALGOL, specifically ALGOL 60. - -
- - - - -
-
-
-
-
-
-
10:28
-
- -
- -
- ALGOL is the basis of pretty much every imperative (procedural) programming language to date. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:30 AM -
- -
- It's honestly pretty crazy to me to look at the timeline here and see that nearly all these fundamental OOP-y designs were all developed independently at around the same time. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:31 AM -
- -
- ALGOL 60 was created by many designers with many famous names too: -John Backus, Peter Naur (yes, those two of Backus-Naur Form), Friedrich Bauer (discovered the stack data structure), Charles Katz (you'll see his name in many papers), John McCarthy (AI, Lisp, etc), Alan Perlis (APL), and many many more. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:31 AM -
- -
- And then the whole academic side runs out of steam in the 2000s, in my mind.. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:32 AM -
- -
- There's the basic history lesson for the roots of all imperative programming languages, as well as some others like Lisp and APL. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:33 AM -
- -
- The 1980s to early 1990s is when OOP really starts picking up steam, Object Pascal, Objective-C, C++, COM, all culminating in Java in 1995 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:33 AM -
- -
- I think I can see traces of all these historical ideas in the languages we use today, and perhaps we can refer back to this list as we go - -
- - - - -
-
-
-
-
-
-
10:33
-
- -
- -
- What Bill is saying about imperative programming languages may accidentally be a good segue into the first major concept of OOP that I have on my list... - -
- - - - -
-
-
-
-
-
-
10:34
-
- -
- -
- Which is that OOP is when you associate behavior with data, in a sense just the idea of a "method". (I am not saying this is a completely correct concept, but it is one that I see frequently discussed.) - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:34 AM -
- -
- One really important thing that I would love to bring up before we dive deep into the philosophy questions is the distinction between Object-Oriented Programming (OOP) and Methods, and why I think this is at the heart of the discussion. - - (edited) -
- - - - -
-
-
-
-
-
-
10:35
-
- -
- -
- I'd argue that 99% of the reasons people want methods (and what many mean by "OOP" in a weird sense) are for the following reasons: - - (1) Organizing procedures under a data type - - (2) Allowing methods as a form syntactic sugar for writing calls in a subject verb object manner, e.g. do_thing(x, y) vs x.do_thing(y) - - (3) Searching for procedures/methods by a data type, especially with the aid of tools such as an IDE - -Regarding (1), I personally believe this is much better solved with a well designed package/module/library system as part of the language. Most OOP languages do not have such a system and usually use classes as a means to organize code. For my programming language Odin, packages have really aided us in terms of organization a lot better than - -Regarding (2), this is a weird linguistic typology thing which I doubt most people will even know unless they speak multiple languages. If you want to learn more about word orders in different languages, I recommend reading the following: - - * https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93object_word_order - * https://en.wikipedia.org/wiki/Verb%E2%80%93subject%E2%80%93object_word_order - - -Regarding (3), this is purely a tooling issue. It comes down to two main aspects: - - * Many people just want to use the tools that they have and how they currently work (there is nothing wrong with that, per se) - * Many people cannot think outside of the current paradigm and think what is being asked for is not possible - - -Doing foo. and waiting for the IDE to autocomplete what is available for that value of a specific data type is extremely useful to many people, but there is not reason it could not work for something that was purely procedural, it is that many languages nowadays do support some form of methods and thus the general need has not arisen. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:36 AM -
- -
- Like Common Lisp's generic methods. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:36 AM -
- -
- So in your opinion, is it not correct to say that "associating behavior with data" is essential to OOP, because all functions are associated with some form of data? (Regardless of syntax?) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:37 AM -
- -
- "mere methods" (Lua is a good example of this, where they're just sugar for passing in the "subject" pointer) are IMO roughly analogous to for-loops or if-blocks, i.e. a syntactic standardization of a widespread common practice - -
- - - - -
-
-
-
-
-
-
10:37
-
- -
- -
- "procedural programming" could be seen as just standardizing a handful of assembly language idioms into language constructs - -
- - - - -
-
-
-
-
-
-
10:37
-
- -
- -
- "mere methods" are, for me, just more of this - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:38 AM -
- -
- they standardize the pattern
struct mything { - // whatever -} - -void mything_do_cool_stuff (struct mything *m, int x) { - // whatever -}
- -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:38 AM -
- -
- I would agree with @demetrispanos and @gingerBill , methods as in the little . notation and OOP are independent concerns - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
demetrispanos
-
- -they standardize the pattern
struct mything { - // whatever -} - -void mything_do_cool_stuff (struct mything *m, int x) { - // whatever -}
- -
-
-
- SirWhinesalot - - - 28-May-22 10:39 AM -
- -
- importantly, note how in the pattern above the function is not tied to struct, you can keep adding as many functions as you want - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:39 AM -
- -
- in OOP, classes have a fixed set of methods, usually - -
- - - - -
-
-
-
-
-
-
-
- Avatar -
- -
-
- Avatar -
SirWhinesalot
-
- -importantly, note how in the pattern above the function is not tied to struct, you can keep adding as many functions as you want - -
-
-
- demetrispanos - - - 28-May-22 10:40 AM -
- -
- yes exactly, that's part of what I mean by "mere" (i.e. they're not wound up in some other concept like a class) - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:39 AM -
- -
- Lua is an example of something I'd like to call an Emergent OO Programming Language , but I'll leave that for a little later to reduce confusion. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 10:40 AM -
- -
- Lua after all is a table oriented language. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:39 AM -
- -
- There's a few of those 😄 - -
- - - - -
-
-
-
- - - - - - - - - - - - - - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
SirWhinesalot
-
- -in OOP, classes have a fixed set of methods, usually - -
-
-
- Kartik Agaram - - - 28-May-22 10:40 AM -
- -
- "open to extension" is another wonderful idea we should discuss at some point. ❤️ Ruby - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:40 AM -
- -
- Smalltalk as well - -
- - - - -
-
- 💡 - 1 -
-
-
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
demetrispanos
-
- -yes exactly, that's part of what I mean by "mere" (i.e. they're not wound up in some other concept like a class) - -
-
-
- bvisness - - - 28-May-22 10:40 AM -
- -
- Would you elaborate on what extra ideas a "class" adds to the picture? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:42 AM -
- -
- I'd say a "mere class" is a struct with a fixed set of "mere methods" (echoing some comments from above) - -
- - - - -
-
-
-
-
-
-
10:42
-
- -
- -
- but classes as practiced add more ideas like visibility, inheritance, etc. - -
- - - - -
-
-
-
-
-
-
10:43
-
- -
- -
- I'd note that while "mere methods" are IMO definitely useful, it's not clear to me what you get from a "mere class" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:43 AM -
- -
- I think a mere class only becomes useful when subtype polymorphism is involved (i.e., a vtable of some sort) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:43 AM -
- -
- ah yes, good point - -
- - - - -
-
-
-
-
-
-
10:43
-
- -
- -
- I agree - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:44 AM -
- -
- The evolution I tend to see is: -* Putting the primary data type first is a nice way to organize vocabularies in people's minds. (I think this is what y'all mean by "mere methods") -* Once you do that, you can also generalize and allow different types to do different things. That pulls in inheritance and static dispatch. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:45 AM -
- -
-
* Putting the primary data type first is a nice way to organize vocabularies in people's minds. (I think this is what y'all mean by "mere methods") -
yes
- -
- - - - -
-
-
-
-
-
-
10:46
-
- -
- -
- but importantly, the generalization of mere methods has consequences - -
- - - - -
-
-
-
-
-
-
10:47
-
- -
- -
- because the set of methods is usually fixed - -
- - - - -
-
-
-
-
-
-
10:47
-
- -
- -
- the moment you do so - -
- - - - -
-
-
-
-
-
-
10:47
-
- -
- -
- for implementation reasons - -
- - - - -
-
-
-
-
-
-
10:47
-
- -
- -
- there are alternative formulations but they tend to have severe performance penalties - -
- - - - -
-
-
-
-
-
-
10:48
-
- -
- -
- this is why I think mere methods and OOP are separate concerns. Having a nice . notation is one thing, introducing the extra machinery is another (and OOP only starts manifesting when the extra machinery comes into play) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:50 AM -
- -
- I guess re: methods and subtypes, we should also mention prototype-style ideas because that gives a related view on what "mere classes" would do - -
- - - - -
-
-
-
-
-
-
10:50
-
- -
- -
- in self (https://en.wikipedia.org/wiki/Self_(programming_language)) you have the idea of a prototype as the unit of implementation delegation - -
- - - - -
-
-
-
-
-
-
10:51
-
- -
- -
- (and of course this carried over into the original version of Javascript OO) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 10:52 AM -
- -
- Yeah. There's definitely class- and prototype-based OO out there. Also extensible vs closed to extension. - -Trying to demarcate precisely the boundaries of "OOP" might be a time sink. I'd much rather chop OOP up into its component pieces, and then we can discuss each separately. And then the question of, "is there anything we missed?" becomes fruitful. - -
- - - - -
-
-
-
-
-
-
10:52
-
- -
- -
- In a game you can have a performance-focused substrate that is closed to extension, and a command language like Lua that is open to extension. Both use OO ideas. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:52 AM -
- -
- I think it's important to address how people think about OO though - -
- - - - -
-
-
-
-
-
-
10:53
-
- -
- -
- because just chopping up the pieces leads to talking about various pieces in isolation and that's not what gets people confused (or irate) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:53 AM -
- -
- Let's talk about some of those pieces though, because getting a more nuanced idea of them will allow us to come back to what does get people confused and irate - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
SirWhinesalot
-
- -this is why I think mere methods and OOP are separate concerns. Having a nice . notation is one thing, introducing the extra machinery is another (and OOP only starts manifesting when the extra machinery comes into play) - -
-
-
- bvisness - - - 28-May-22 10:54 AM -
- -
- I think we should start discussing this "extra machinery". I'm not sure what angle to discuss first; there's the more nuts-and-bolts ideas such as inheritance and polymorphism, but there's also the very hairy subject of object-oriented design. @SirWhinesalot is our point person for that, but I'd like to make sure we feel we've covered our bases first. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:55 AM -
- -
- Right, might be worth posting that meme making fun of GeeksForGeeks here 😄 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:56 AM -
- -
- heh - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:56 AM -
- -
- So what we're talking about here is the idea that "OOP models the real world". - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:56 AM -
- -
- that's indeed the most important meme to address IMO - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:56 AM -
- -
- Should we tackle that now? or after we split OOP up first? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 10:57 AM -
- -
- and it links up to almost everything else - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 10:57 AM -
- -
- Let's just get into it. - -
- - - - -
-
-
-
-
-
-
10:57
-
- -
- -
- We can branch from there into everything else, like Demetri says - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 10:57 AM -
- -
- What does it mean for OOP to model the real world? Here's what Wikipedia has to say (technically from the Domain-Driven Design page, but the two are intimately related): - -
In terms of object-oriented programming it means that the structure and language of software code (class names, class methods, class variables) should match the business domain. For example, if a software processes loan applications, it might have classes like LoanApplication and Customer, and methods such as AcceptOffer and Withdraw.
- -
- - - - -
-
-
-
-
-
-
10:57
-
- -
- -
- I would like to focus on that Customer class. Think of a website like Amazon, what does a Customer do? They can login/logout, purchase items, review items, contact customer support, etc. They also have a lot of data about them like their user-info, preferences, purchases, support tickets, etc. - -
- - - - -
-
-
-
-
-
-
10:58
-
- -
- -
- What data and methods should the Customer class have? - -
- - - - -
-
-
-
-
-
-
10:58
-
- -
- -
- Really think about this and the consequences it has on the structure of the codebase. All of the above? Classes should have a "single-responsibility" (supposedly). What should the single responsibility of the Customer class be? - -
- - - - -
-
-
-
-
-
-
10:58
-
- -
- -
- You see how we immediatelly start getting into trouble? - -
- - - - -
-
- 😄 - 1 -
-
-
-
-
-
-
-
-
10:58
-
- -
- -
- Then there's the issue of structuring your code into class hierarchies based on real-world concepts, e.g. Customer : Person, Seller : Person, Employee : Person. - -
- - - - -
-
-
-
-
-
-
10:58
-
- -
- -
- The problem of course is that the same person can not only be all three, they can be different subsets at different times! Even real-world taxonomies need to be updated from time to time, and this modeling style is imposing that kind of rigid structure, with far less certainty, on your data and behavior. - -
- - - - -
-
-
-
-
-
-
10:59
-
- -
- -
- This style is considered bad practice these days, but even without the taxonomy nonsense the core issue remains, which is trying to model real-world concepts as bundles of encapsulated data + behavior. It just doesn't work well in practice, that idea is the fundamental mistake. - -
- - - - -
-
-
-
-
-
-
10:59
-
- -
- -
- IMO of course - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:00 AM -
- -
- One wonderful book that made the rounds last year: https://buttondown.email/hillelwayne/archive/why-you-should-read-data-and-reality - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 11:01 AM -
- -
- My personal view that thinking "OOP models the real world" is wrong because it is a category error. You cannot treat [programming objects] as "real objects" since "real objects" and "programming objects" have little connection to each other ontologically. This is why I've previously called OOP a form of misinterpreted and misapplied Aristotelian Metaphysics applied to a domain it was never meant to model[2]. - -By this statement, I mean that artificially conforming to any/all relations between data and types to an artificial hierarchy of agency is a form of naïve-Aristotelian metaphysics. Since there is no actual agency in the programming objects, it is a partial fallacy (and as previously stated, category error). When trying to conform a program to have a particular structure when it does not naturally, the absence of a structure in a program in more useful than a bad structure. - -[1] https://en.wikipedia.org/wiki/Category_mistake -[2] https://www.gingerbill.org/article/2020/05/31/progamming-pragmatist-proverbs/ - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:02 AM -
- -
- Map vs territory confusion, right? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 11:02 AM -
- -
- There is also the other aspect that in an actual Aristotelian metaphysics, an object can belong to an infinite amount of "classes" in any moment and even change depending on the situation. - -
- - - - -
-
-
-
-
-
-
11:02
-
- -
- -
- In a way, yes. - -
- - - - -
-
-
-
-
-
-
11:03
-
- -
- -
- When we discuss of an object, we are speaking of it about what is relevant to us in that situation. - -
- - - - -
-
-
-
-
-
-
11:03
-
- -
- -
- Let's take a random object off my table right now: a lens cap. - -
- - - - -
-
-
-
-
-
-
11:03
-
- -
- -
- A lens cap could be in the class of objects that cover a lens. - -
- - - - -
-
-
-
-
-
-
11:03
-
- -
- -
- But it could also be used a coaster for my drink. - -
- - - - -
-
-
-
-
-
-
11:04
-
- -
- -
- It could also be used as an eye patch. - -
- - - - -
-
- 🏴‍☠️ - 1 -
-
-
-
-
-
-
-
-
11:04
-
- -
- -
- Or a weird weapon. - -
- - - - -
-
- 🗡️ - 1 -
-
- ⚫ - 1 -
-
- 📷 - 1 -
-
-
-
-
-
-
-
-
11:04
-
- -
- -
- Or a one of an infinite number of things with infinite uses. - -
- - - - -
-
-
-
-
-
-
11:04
-
- -
- -
- The question is realizing what is relevant for the situation. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:05 AM -
- -
- Now you've got me thinking about what a computer that can fluidly move between ontologies would look like.. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 11:06 AM -
- -
- This is why, in my personal opinion, a huge issue with force something to an "object"/"class"/etc has issues with. Things belong to more than just one class and trying to force it into one category can be very bad, especially when there is no "object" to speak of in the first place, only algorithms and data structures. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:06 AM -
- -
- The relational/logical model tends to be much better at this, since you can add/retract facts about an object - -
- - - - -
-
-
-
-
-
-
11:06
-
- -
- -
- Entity-Component Systems are a form of relational model btw - -
- - - - -
-
-
-
-
-
-
11:06
-
- -
- -
- Some people think they are a form of OO, that's incorrect - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:08 AM -
- -
- I think whether or not it is wrong, "OO solves problem by modeling the real world" is both believed and practiced, and indeed it is widely used to advertise and teach OO - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:08 AM -
- -
- Indeed, that's how I was taught in university - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:08 AM -
- -
- this is what I mean about talking about how people think about it - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:08 AM -
- -
- The best defense I've heard for OO design is to limit your ambitions to modeling solutions, not problems. That avoids the issues@gingerBill raises, but it's also a much more modest goal. OO design books seem to pay this idea lip service, but quickly go back to thinking symbols are the thing they represent. It's a very easy mental trap to fall into. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:09 AM -
- -
- modeling solutions is antithetical to OO-best practices (as taught), because the right solution often involves some sort of "Manager" class that handles the data, and these are "frowned upon" because they don't bundle the data and behavior - -
- - - - -
-
- 👍 - 2 -
-
-
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -The best defense I've heard for OO design is to limit your ambitions to modeling solutions, not problems. That avoids the issues@gingerBill raises, but it's also a much more modest goal. OO design books seem to pay this idea lip service, but quickly go back to thinking symbols are the thing they represent. It's a very easy mental trap to fall into. - -
-
-
- gingerBill - - - 28-May-22 11:10 AM -
- -
- The irony of that statement is that is kind of the opposite of the point. Programming is a form of problem solving. If you have already solved the problem, then redesigning it to be OOP is really weird, and borderline masturbation. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:10 AM -
- -
-
limit your ambitions to modeling solutions, not problems. -
I would phrase this as "[90s style C++/Java] OO offers the ability to form hierarchies of data structures and functions but that this is usually misinterpreted to mean that it will be useful to model hierarchies of concepts in the world outside the program"
- -
- - - - -
-
- 👍 - 1 -
-
-
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
gingerBill
-
- -The irony of that statement is that is kind of the opposite of the point. Programming is a form of problem solving. If you have already solved the problem, then redesigning it to be OOP is really weird, and borderline masturbation. - -
-
-
- Kartik Agaram - - - 28-May-22 11:11 AM -
- -
- The idea is that once you've solved a problem, OO Design is a good way to continue to maintain the solution without forgetting why you did what you did. Software systems can last a long time! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:12 AM -
- -
- I've found no advantage to an OO design vs any other form of design with a clear structure, unless the features provided by OO (like subtype polymorphism) were necessary - -
- - - - -
-
-
-
-
-
-
11:12
-
- -
- -
- In fact quite the opposite, since OO design can impose a lot of rigidity that is hard to get rid off - -
- - - - -
-
-
-
-
-
-
11:13
-
- -
- -
- See weird workaround like C# extension methods for an example - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -The idea is that once you've solved a problem, OO Design is a good way to continue to maintain the solution without forgetting why you did what you did. Software systems can last a long time! - -
-
-
- gingerBill - - - 28-May-22 11:13 AM -
- -
- See the trick? If it needs to be continuously improved, it's not a solution, yet. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:13 AM -
- -
- I would say I almost never use inheritance, but I almost always use methods - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:13 AM -
- -
- and if someone told me I could never use inheritance again I would not consider it a big loss - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:13 AM -
- -
- I'm actually not familiar with any non-OO design methodology 😄 They kinda sucked the oxygen out of the room, didn't they? - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -I'm actually not familiar with any non-OO design methodology 😄 They kinda sucked the oxygen out of the room, didn't they? - -
-
-
- SirWhinesalot - - - 28-May-22 11:14 AM -
- -
- there are many architectures you can use. Things like publish/subscribe, model-view-update, etc. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:14 AM -
- -
- Certainly though the term "design patterns" has come to exclusively mean "object-oriented design patterns", and really the gang of four stuff - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -I'm actually not familiar with any non-OO design methodology 😄 They kinda sucked the oxygen out of the room, didn't they? - -
-
-
- gingerBill - - - 28-May-22 11:14 AM -
- -
- "JUST SOLVE THE PROBLEM YOU HAVE" is my preferred one. - -
- - - - -
-
- 💯 - 7 -
-
-
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Certainly though the term "design patterns" has come to exclusively mean "object-oriented design patterns", and really the gang of four stuff - -
-
-
- bvisness - - - 28-May-22 11:15 AM -
- -
- and that persists to this day, thanks probably to universities? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:15 AM -
- -
- yes I think the fact that OO has the superficial appearance of a "theory of programming" is important here - -
- - - - -
-
-
-
-
-
-
11:15
-
- -
- -
- (re: universities) - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:15 AM -
- -
- universities had rapidly increasing needs to "produce programmers" but universities loathe doing anything that might look like vocational school - -
- - - - -
-
-
-
-
-
-
11:16
-
- -
- -
- OOP looked like it had some ideas from type theory, had some kind of taxonomy scheme, had some claims to provable properties - -
- - - - -
-
-
-
-
-
-
11:16
-
- -
- -
- and so it was compatible with what a university might be persuaded to adopt - -
- - - - -
-
-
-
-
-
-
11:17
-
- -
- -
- and it also had the claim of "intuitively models the real world, so businesses like it" - -
- - - - -
-
- 💡 - 1 -
-
-
-
-
-
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:15 AM -
- -
- https://en.wikipedia.org/wiki/Software_design does have a list. I guess I'm not aware of it because I don't do design 😅 - -
- - -
-
- -
-
-
- - - -
-
Software design is the process by which an agent creates a specification of a software artifact intended to accomplish goals, using a set of primitive components and subject to constraints. Software design may refer to either "all the activity involved in conceptualizing, framing, implementing, commissioning, and ultimately modifying complex sys...
-
- -
- -
- - -
-
- - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:18 AM -
- -
- My university thankfully presented all paradigms (procedural, oo, functional, logical) - -
- - - - -
-
-
-
-
-
-
11:19
-
- -
- -
- a good question there is if OO is an actual paradigm - - (edited) -
- - - - -
-
-
-
-
-
-
11:19
-
- -
- -
- Alan Kay certainly thought so, but Smalltalk OO is a very different beast from C++ or Java or whatever - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:20 AM -
- -
- I think Kay has sufficiently lost that battle that there's not much point talking about it as a peer - -
- - - - -
-
-
-
-
-
-
11:20
-
- -
- -
- when I want to talk about his stuff I say "Kay style OO" or "message passing OO" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:22 AM -
- -
- I personally think Kay-style OO could be seen as a unique programming paradigm (when you include the full reflexivity and the IDE as the OS sort of programming style Smalltalk has), but regular OO is not, it's just procedural programming with a pointless structure on top - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:22 AM -
- -
- the folk understanding of OO, which IMO is like 90+% of people, is something like -- your program is a collection of classes -- one class per file -- each class represents some concept from the real world -- each class has a single responsibility (this is at odds with above but whatever :P) -- there are "good patterns" of assembling classes into programs to solve problems - - (edited) -
- - - - -
-
- 💯 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 11:23 AM -
- -
- I (luckily?) don't have any programming education, let alone academic, so I cannot comment on what is or what is not taught commonly in Universities beyond what I have heard. From what I can tell, they seem to vary extremely widely compared to say harder science such as Physics or Chemistry. If you go to one University for Physics, it'll be similar enough to another. But for Computer Science (Infomatics), it will be very very different - -
- - - - -
-
- 👍 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:23 AM -
- -
- Among other critiques, this approach causes some blind spots because you get trained to think in terms of nouns and deemphasize verbs: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:24 AM -
- -
- yes, a very important essay in this history - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -Among other critiques, this approach causes some blind spots because you get trained to think in terms of nouns and deemphasize verbs: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html - -
-
-
- bvisness - - - 28-May-22 11:24 AM -
- -
- I love that post. When Demetri showed it to me for the first time years ago, I was shocked by how much it resonated with me - -
- - - - -
-
-
-
-
-
-
11:25
-
- -
- -
- This seems like as good a time as any for Demetri to talk about Java and what it did to the world of software - -
- - - - -
-
-
-
-
-
-
11:25
-
- -
- -
- which he volunteered to do as someone who lived through the Great Javafication - -
- - - - -
-
-
-
-
-
-
11:31
-
- -
- -
- To give some context for that, though, my understanding is that Java really took over the software industry in the mid-90s for a variety of reasons I'm not entirely familiar with - -
- - - - -
-
-
-
-
-
-
11:31
-
- -
- -
- He talked about it some on our podcast episode about programming education, as I recall (https://handmade.network/podcast/ep/eeac46c9-5e90-4b1c-9104-cff49734764d) - -
- - - - -
-
-
-
-
-
-
11:32
-
- -
- -
- And much of what he laid out in his "folk understanding of OO" above is, as far as I know, a direct line from Java - -
- - - - -
-
-
-
-
-
-
11:32
-
- -
- -
- for example, one class per file - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:34 AM -
- -
- Java uses classes for everything. Namespacing, modeling the solution, modeling the world, file system organization... - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:34 AM -
- -
- Yes I believe other languages aren't as restrictive, but the pattern is visible in a lot of C# codebases for example - - (edited) -
- - - - -
-
-
-
-
-
-
11:34
-
- -
- -
- one file per class - -
- - - - -
-
-
-
-
-
-
11:34
-
- -
- -
- because they sort of act like modules as well, specially when it's a "static" class with "static" methods - -
- - - - -
-
-
-
-
-
-
11:35
-
- -
- -
- (read: a bog standard procedural thing with extra keywords) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:36 AM -
- -
- Java was the first "real" programming language I learned, and it took me a long time to broaden my understanding enough to unlearn a lot of the decisions it made. static is certainly an example of that; a great way to obscure a very obvious concept. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 11:37 AM -
- -
- It was the first question I asked my teacher: "What does static mean?" - -
- - - - -
-
-
-
-
-
-
11:37
-
- -
- -
- I had been exposed to Pascal before, but not in an educational setting - -
- - - - -
-
-
-
-
-
-
11:37
-
- -
- -
- So public static void main() inside a class was very confusing - -
- - - - -
-
-
-
-
-
-
11:38
-
- -
- -
- Btw his answer was "I'll explain that by the end" - -
- - - - -
-
-
-
-
-
-
11:38
-
- -
- -
- "Ignore it for now, just know it needs to be there" - -
- - - - -
-
-
-
-
-
-
11:38
-
- -
- -
- never a good start - -
- - - - -
-
-
-
-
-
-
11:40
-
- -
- -
- it was much worse for my partner, her teacher decided explaining the difference between static and non-static was a great discussion topic for class 2 of newbie bioinformatics learning to program - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:40 AM -
- -
- static is a great scapegoat example for the problems with Java's design decisions, but I suspect there is a lot more to it than that - -
- - - - -
-
-
-
-
-
-
11:41
-
- -
- -
- For example, I'm curious if from @demetrispanos's perspective, the design of Java's standard library had an impact here (or if that was just an outflow of the language design) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:42 AM -
- -
- the standard library specifically, I'm not sure ... though Java definitely pioneered the idea that the standard library would have a canned solution for almost everything - -
- - - - -
-
-
-
-
-
-
11:42
-
- -
- -
- I remember buying "Java in a Nutshell" in the late 90s and being genuinely shocked at its size - -
- - - - -
-
-
-
-
-
-
11:42
-
- -
- -
- I think the large standard library overlapped with the idea of programs as "connecting objects to each other" - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:43 AM -
- -
- Well perhaps it would be best to just step back then and talk about the shift you saw in the industry when Java hit the scene - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:44 AM -
- -
- Java was the front runner but C++ in the 90s was also a major participant (indeed Design Patterns came from the C++ community) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:45 AM -
- -
- Also Smalltalk! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:45 AM -
- -
- I think the biggest change was just how much marketing effort was behind "90s OOP", led primarily by Java (in terms of marketing) - -
- - - - -
-
-
-
-
-
-
11:46
-
- -
- -
- Java promised everybody a pony - -
- - - - -
-
-
-
-
-
-
11:46
-
- -
- -
- universities got to teach a thing that looked like a theory of programming - -
- - - - -
-
-
-
-
-
-
11:46
-
- -
- -
- businesses got programmers that could program in "intuitive real world concepts" - -
- - - - -
-
-
-
-
-
-
11:46
-
- -
- -
- new programmers were told they didn't have to worry about details their predecessors used to sweat over, and could just draw object/class hierarchy diagrams - -
- - - - -
-
-
-
-
-
-
11:47
-
- -
- -
- (there were also other Java promises re: security and portability that aren't relevant here) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:48 AM -
- -
- I wonder how much of Java being OO was because of the marketing efforts predating it.. 🤔 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:48 AM -
- -
- well, to ask a question I think I know the answer to...how did Java live up to the hype :) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:48 AM -
- -
- I think Gosling definitely saw himself as successor to Bjarne who was successor to Ritchie etc. - -
- - - - -
-
-
-
-
-
-
11:49
-
- -
- -
- and indeed Java was conceptualized as a kind of "C++, the good parts" - -
- - - - -
-
-
-
-
-
-
11:49
-
- -
- -
- and it's telling what they thought were "the good parts" - -
- - - - -
-
-
-
-
-
-
11:49
-
- -
- -
- class hierarchies - -
- - - - -
-
-
-
-
-
-
11:49
-
- -
- -
- you don't just have the option of classes, everything is a class (even your program itself) - -
- - - - -
-
-
-
-
-
-
11:50
-
- -
- -
- I would say that by the end of the 90s the thing we now know as "Java/C++ OOP" was cemented as the responsible way to write software - -
- - - - -
-
-
-
-
-
-
11:51
-
- -
- -
- or rather, cemented the reputation as such - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:51 AM -
- -
- One reason it took so long to notice that OO didn't always work well, was that it worked best in the lower levels where people designed and implemented languages like Java. After they put in all the effort to build the language over a decade, it took a decade of using OO methodologies in anger to crystallize its limitations. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:51 AM -
- -
- well also it genuinely did work reasonably well with widget hierarchies in GUIs - -
- - - - -
-
- 👍 - 1 -
-
-
-
-
-
-
-
-
11:52
-
- -
- -
- but that was IMO an accident of overlap between problem and solution domain - -
- - - - -
-
-
-
-
-
-
11:52
-
- -
- -
- the widgets are code objects, and having hierarchies of code objects is something that OOP delivers as it says on the tin - -
- - - - -
-
-
-
-
-
-
11:52
-
- -
- -
- and indeed "textbox with a slider" is a reasonable conceptual descendant of "plain textbox" - -
- - - - -
-
-
-
-
-
-
11:53
-
- -
- -
- so I think many people saw that there was a good solution for an ascendant problem (the 90s saw the rise of GUIs to dominance) - -
- - - - -
-
-
-
-
-
-
11:53
-
- -
- -
- and they figured this would just be the first major success of many - -
- - - - -
-
-
-
-
-
-
11:54
-
- -
- -
- but widget hierarchies are much more usefully modeled by OOP than, say, customer/person hierarchies - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:55 AM -
- -
- That might be an interesting example to break down further - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:55 AM -
- -
- (Except when widgets used inner classes. That was a whole other can of worms..) - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
demetrispanos
-
- -but widget hierarchies are much more usefully modeled by OOP than, say, customer/person hierarchies - -
-
-
- SirWhinesalot - - - 28-May-22 11:56 AM -
- -
- Important to note here that UI frameworks moved away from "Split button inherits from Button" to "Split button is a button with a nested dropdown and a vertical line", you see that shift with the introduction of WPF at least - -
- - - - -
-
-
-
-
-
-
11:57
-
- -
- -
- so the move away from inheritance to composition was definitely ongoing in the 2000s - -
- - - - -
-
- 👍 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 11:57 AM -
- -
- yeah this is what I meant by "reasonably well", i.e. it was better than no organization at all but didn't end up being the one abstraction to rule all of GUI - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 11:58 AM -
- -
- I do think it's interesting though that it was still a more effective model than what you tend to see elsewhere. @Kartik Agaram and @SirWhinesalot talked in the planning doc about objects needing to belong to the "solution domain", not the "problem domain", and this feels like a similar situation to me - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 11:59 AM -
- -
- One thing I still grapple with is that it's easier to use computers to talk about computers than it is to do something useful. That leads to all our yak shaving and abstraction-tower-building tendencies. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:01 PM -
- -
- Yeah, OO is a rather natural way to model GUIs (not necessarily the only way, nor the best), but it works. A button has some internal state, it responds to some events, those events are shared between all kinds of GUI entities. A "Widget" interface that gets implemented by many different Widget classes is a rather obvious way to model this - -
- - - - -
-
-
-
-
-
-
12:02
-
- -
- -
- even in languages without native OO support - -
- - - - -
-
-
-
-
-
-
12:02
-
- -
- -
- See COM or GTK in C for examples - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -I do think it's interesting though that it was still a more effective model than what you tend to see elsewhere. @Kartik Agaram and @SirWhinesalot talked in the planning doc about objects needing to belong to the "solution domain", not the "problem domain", and this feels like a similar situation to me - -
-
-
- Kartik Agaram - - - 28-May-22 12:02 PM -
- -
- That HN comment (https://news.ycombinator.com/item?id=785601#785833) actually hit me like a pile of bricks. Until then I'd only heard that you used inheritance to model is-a relationships, then wandered off because that seemed to suck. - -
- - -
-
- -
- - - - -
-
- - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:02 PM -
- -
- yes how many times has a junior programmer agonized over "is-a" vs "has-a" - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
demetrispanos
-
- -yes how many times has a junior programmer agonized over "is-a" vs "has-a" - -
-
-
- bvisness - - - 28-May-22 12:03 PM -
- -
- I did this for years - -
- - - - -
-
-
-
-
-
-
12:03
-
- -
- -
- and it was a meaningless question - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:03 PM -
- -
- yeah and the memeplex around 90s OOP invites that activity - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:03 PM -
- -
- it very strongly implies that this is what you should do - -
- - - - -
-
- 👍 - 1 -
-
-
-
-
-
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:03 PM -
- -
- interface vs implementation inheritance. And then I find that in practice, all inheritance is good for is sharing code. - - (edited) -
- - - - -
-
-
-
- - - - - - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -and it was a meaningless question - -
-
-
- SirWhinesalot - - - 28-May-22 12:04 PM -
- -
- meaningless but unfortunately very critical if you're in an OO language - -
- - - - -
-
-
-
-
-
-
12:04
-
- -
- -
- because the decision is one you're mostly stuck with - -
- - - - -
-
-
-
-
-
-
12:04
-
- -
- -
- without a major rewrite - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
SirWhinesalot
-
- -meaningless but unfortunately very critical if you're in an OO language - -
-
-
- bvisness - - - 28-May-22 12:04 PM -
- -
- this I would say is a strong Java-ism - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:05 PM -
- -
- In practice, why is a relationship between two concepts being model as a language feature? - -
- - - - -
-
-
-
-
-
-
12:05
-
- -
- -
- There's absolutely no reason for this - - (edited) -
- - - - -
-
-
-
-
-
-
12:05
-
- -
- -
- I can model that A is a B in 1000 ways - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:05 PM -
- -
- well, the dirty secret is that it's not - -
- - - - -
-
-
-
-
-
-
12:05
-
- -
- -
- there is not even an attempt at it - -
- - - - -
-
-
-
-
-
-
12:05
-
- -
- -
- all that is attempted is sharing implementation details with ancestors - -
- - - - -
-
-
-
-
-
-
12:06
-
- -
- -
- the language never engages with whether the alleged is-a relationship is valid - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:06 PM -
- -
- true, you actually have to be careful to ensure an A is actually a B - -
- - - - -
-
-
-
-
-
-
12:06
-
- -
- -
- in fact traps like that are typical exam questions - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:06 PM -
- -
- the is-a aspect is entirely in people's minds - -
- - - - -
-
- ☝️ - 2 -
-
-
-
-
-
-
-
-
12:06
-
- -
- -
- the thing that exists in the material world is sharing code - -
- - - - -
-
- 💯 - 2 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:06 PM -
- -
- which is much better done with before/after advice or hooks that receive anonymous functions - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:08 PM -
- -
- When teaching my FIRST robotics students, I've struggled in the past with better examples to illustrate how inheritance works in Java than the classic "Cat is-a Animal" thing, and I suppose that's largely because inheritance isn't actually very good at modeling anything practical - -
- - - - -
-
-
-
-
-
-
12:08
-
- -
- -
- but the concept must be taught if we are to use the language - -
- - - - -
-
-
-
-
-
-
12:08
-
- -
- -
- (we no longer use the language) - -
- - - - -
-
- 👍 - 2 -
-
-
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
demetrispanos
-
- -yes how many times has a junior programmer agonized over "is-a" vs "has-a" - -
-
-
- bvisness - - - 28-May-22 12:09 PM -
- -
- One other aspect of OOP I think might be worth exploring is the idea of "agency" of objects, which "has-a" gets into - -
- - - - -
-
-
-
-
-
-
12:09
-
- -
- -
- I'm not sure if we've really touched on that yet - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:09 PM -
- -
- perhaps in passing but we haven't deep dived on it - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:10 PM -
- -
- This also relates in my mind to the actor model and perhaps the talk @Kartik Agaram mentioned by Richard Feldman about how OOP design makes each object a "small computer" on its own - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:11 PM -
- -
- I might say "small machine" but yes, and indeed this is the origin in Simula - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:11 PM -
- -
- This is to me different from the taxonomy issue - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:11 PM -
- -
- indeed, separate concern - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:11 PM -
- -
- the execution of the program is a simulation of many independent machines doing things to each other - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:12 PM -
- -
- this is "OOP as a model of computation" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:13 PM -
- -
- With hindsight, the question I'm left with is, why did anyone ever consider this a good thing. Alan Kay made the analogy with biological cells in http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html#4, but back then (i.e. until the 90s when I started programming) we all assumed that was a good thing. - -
- - - - -
-
- ☝️ - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:14 PM -
- -
- I think it became popular because of the idea that you'd use "code objects" the same way you use, say, screws from Home Depot - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:14 PM -
- -
- ah yes, software components. The ubiquitous siren of lego blocks. - -
- - - - -
-
- legobrick - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:14 PM -
- -
- starting a new blog engine? go get some XYZ database screws and some PQR rendering bolts and you're 90% done - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:14 PM -
- -
- one important distinction between the smalltalk view (that affects how "good" it is) is the fact that objects are "live". You're not describing a simulation in terms of a software description of communicating objects (as in Java or C++), but actually witnessing the objects interact and changing their behavior as appropriate - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:15 PM -
- -
- this always felt like Alan Kay marketing speak to me - -
- - - - -
-
-
-
-
-
-
12:15
-
- -
- -
- databases are similarly "alive" in that the tables change with each insert - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:16 PM -
- -
- live editing is also not dependent on any sort of "object" 🙂 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:16 PM -
- -
- Kay is a very creative guy, but he is also easily tempted by marketing language - -
- - - - -
-
-
-
-
-
-
12:16
-
- -
- -
- (this is fine, good ideas need marketing) - -
- - - - -
-
-
-
-
-
-
12:16
-
- -
- -
- anyway, it is indeed important to address OOP and the subject of software components/reuse - -
- - - - -
-
-
-
-
-
-
12:17
-
- -
- -
- because it definitely was perceived as the way to achieve the latter - -
- - - - -
-
-
-
-
-
-
12:17
-
- -
- -
- you no longer would do the "unimportant" "tedious" work of writing a string formatting function, you'd just use a java.util.StringFormatter - -
- - - - -
-
-
-
-
-
-
12:17
-
- -
- -
- (I don't know if that exists, it probably doesn't) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:18 PM -
- - - - - - -
-
-
-
-
-
-
12:18
-
- -
- -
- so close 🙂 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:18 PM -
- -
- and this overlaps with Java's enormous standard library, because it was meant to be analogous to walking into Home Depot and getting the screws you need - -
- - - - -
-
-
-
-
-
-
12:18
-
- -
- -
- haha closer than I thought - -
- - - - -
-
-
-
-
-
-
12:18
-
- -
- -
- importantly, I never saw any kind of argument for why an "object" would be more reusable than a function - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:18 PM -
- -
- but it was widely believed to be the case - -
- - - - -
-
-
-
-
-
-
12:19
-
- -
- -
- and that was a big part of the Java marketing agenda - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:18 PM -
- -
- but again, this has nothing to do with objects, a module will do just fine for this purpose - -
- - - - -
-
-
-
-
-
-
12:18
-
- -
- -
- yup - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:19 PM -
- -
- the only case I can see for it is when the object is "live", meaning you acquire the object already in the state you want, but that's a big stretch - -
- - - - -
-
-
-
-
-
-
12:19
-
- -
- -
- why not just... configure the thing? - -
- - - - -
-
-
-
-
-
-
12:19
-
- -
- -
- was never clear either - -
- - - - -
-
-
-
-
-
-
12:20
-
- -
- -
- specially not in a Java like language where Classes may as well be modules with extra steps - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:20 PM -
- -
- yes and actually you can see some of this in how Python played out, because it was very oriented toward modules - -
- - - - -
-
-
-
-
-
-
12:20
-
- -
- -
- but then got a large influx of what I'll uncharitably call "java refugees" in the mid 00s - -
- - - - -
-
-
-
-
-
-
12:21
-
- -
- -
- and suddenly you started seeing a lot of python that looked like java - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:21 PM -
- -
- Reuse does feel like an idea important enough to be worth trying for a couple of decades. I'm glad we're past it now. At least for some people today, a library you can reuse registers as more liability than asset. Now you gotta wire it into your supply chain and watch out for vulnerabilities. - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -Reuse does feel like an idea important enough to be worth trying for a couple of decades. I'm glad we're past it now. At least for some people today, a library you can reuse registers as more liability than asset. Now you gotta wire it into your supply chain and watch out for vulnerabilities. - -
-
-
- bvisness - - - 28-May-22 12:22 PM -
- -
- It does feel like that's the trend, thankfully, but I suspect the dream of perfect reuse will never die out - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:22 PM -
- -
- I think the reuse concern is largely mercenary - -
- - - - -
-
-
-
-
-
-
12:22
-
- -
- -
- I mean it's mainly something businesses care about to reduce costs - -
- - - - -
-
-
-
-
-
-
12:22
-
- -
- -
- this is fine, keeping costs low is a reasonable concern - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:23 PM -
- -
- The key for me is to minimize zones of ownership. Reuse makes most sense when a vocabulary of components was coherently designed to compose well. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:23 PM -
- -
- but I don't think it's ultimately a deep concern about quality of code (even if it overlaps with quality concerns like single-point-of-truth) - -
- - - - -
-
-
-
-
-
-
12:24
-
- -
- -
- I want to distinguish between "reuse" and just "use by someone else" - -
- - - - -
-
-
-
-
-
-
12:24
-
- -
- -
- because I think they're conflated, but really only the second thing matters in most cases - -
- - - - -
-
-
-
-
-
-
12:24
-
- -
- -
- if I write the postgres database engine, what's important is that many people can use it (and not write their own) - -
- - - - -
-
-
-
-
-
-
12:24
-
- -
- -
- what's not important is that it can be used to make a substantially different database engine - -
- - - - -
-
-
-
-
-
-
12:24
-
- -
- -
- but that's the "just like screws" idea - -
- - - - -
-
-
-
-
-
-
12:25
-
- -
- -
- the same screws can make a table or a bookshelf etc. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:26 PM -
- -
- Do you think object-oriented design is worse at providing reuse than other approaches, or just completely unrelated? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:26 PM -
- -
- one are where OOP matters for reuse is the idea of an interface that can be implemented in many different ways - -
- - - - -
-
-
-
-
-
-
12:26
-
- -
- -
- it sets a boundary between parts of the code - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:26 PM -
- -
- I think OOP tilted harder at that particular problem. Making it easier to build things that you can reuse with anything else. It failed, but that's ok. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:26 PM -
- -
- I would hesitate to attribute interfaces to any particular discipline - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Do you think object-oriented design is worse at providing reuse than other approaches, or just completely unrelated? - -
-
-
- demetrispanos - - - 28-May-22 12:27 PM -
- -
- I think it is in practice worse because it forces you to buy into the author's specific set of branded lego pieces that don't quite fit anyone else's - -
- - - - -
-
-
-
-
-
-
12:27
-
- -
- -
- in my experience the things that are easiest to glue together have extremely simple and unopinionated representations - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:28 PM -
- -
- but if you have to instantiate an object from some complex hierarchy merely to get started, you have a lot of friction - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:28 PM -
- -
- It seems to me that easy reuse is in direct conflict with ideas of taxonomy and ownership and agency - - (edited) -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:28 PM -
- -
- the unix way is "almost everything is lines of text, and you have to parse them" - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:28 PM -
- -
- it's annoying, but easy to glue together - - (edited) -
- - - - -
-
-
-
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Do you think object-oriented design is worse at providing reuse than other approaches, or just completely unrelated? - -
-
-
- gingerBill - - - 28-May-22 12:28 PM -
- -
- So this depends. Most traditonal inheritance based OOP are worse than plain procedural, but something like Go's implicit interfaces (which some don't even call OOP) is a lot more reusable. - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
gingerBill
-
- -So this depends. Most traditonal inheritance based OOP are worse than plain procedural, but something like Go's implicit interfaces (which some don't even call OOP) is a lot more reusable. - -
-
-
- gingerBill - - - 28-May-22 12:28 PM -
- -
- The big issue is that Go's interfaces require GC and have many performance issues. - -
- - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:29 PM -
- -
- as @skejeton was getting at in #fishbowl-audience, a table doesn't own a screw, a table leg doesn't own a screw, they're just all there - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:29 PM -
- -
- the C way is "almost everything is arrays of a few machine-type primitives" - -
- - - - -
-
-
-
-
-
-
12:29
-
- -
- -
- and that too has proven to be a very productive way to glue things together, as it is the basis of almost every practical FFI design - -
- - - - -
-
-
-
-
-
-
12:29
-
- -
- -
- the web way is "almost everything is JSON" - -
- - - - -
-
-
-
-
-
-
12:29
-
- -
- -
- and again, that is easy to glue together - -
- - - - -
-
-
-
-
-
-
12:30
-
- -
- -
- Java attempted "amost everything is XML" but it rightfully went up in flames - -
- - - - -
-
-
-
-
-
-
12:30
-
- -
- -
- because XML has many of the same problems vs JSON as Java OOP vs procedural - -
- - - - -
-
-
-
-
-
-
12:31
-
- -
- -
- JSON makes no pretense of modeling the real world, it's just a record - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:32 PM -
- -
- rich hickey goes into this on why systems level concerns are different from application level concerns, and the data exchange between "processes" or "entities" in a system should be very "loose" - -
- - - - -
-
-
-
-
-
-
12:32
-
- -
- -
- it's why unix has just strings, or the web has json everywhere - -
- - - - -
-
-
-
-
-
-
12:33
-
- -
- -
- this is also why stuff like dependency injection frameworks exist, their job is to set up the "wiring" between various components, which gets more and more complicated the more detailed the interface specification they have to communicate is - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:35 PM -
- -
- Complexity feels like something worth talking about head on. A lot of our discussion has had it implicitly in the background. The promise of many languages/tools/paradigms is "treat complexity as an externality. Infinite scale!" This never bears out, and lately I consider it a bad direction. Why is it so important to be able to scale up in complexity? - -Oh wait, where am I, this is Handmade Network. I'm preaching to the choir 😅 - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
Kartik Agaram
-
- -Complexity feels like something worth talking about head on. A lot of our discussion has had it implicitly in the background. The promise of many languages/tools/paradigms is "treat complexity as an externality. Infinite scale!" This never bears out, and lately I consider it a bad direction. Why is it so important to be able to scale up in complexity? - -Oh wait, where am I, this is Handmade Network. I'm preaching to the choir 😅 - -
-
-
- bvisness - - - 28-May-22 12:37 PM -
- -
- Well on that note, another thing that I had on my list was the idea that OOP allows you to scale up development and solve more complex problems. One of the links you posted during planning directly stated this exact idea. But...is there any merit to that idea at all? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:38 PM -
- -
- Was that perhaps just an accident of all the other things Java provided out of the box? - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:38 PM -
- -
- Namespacing does help. - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:39 PM -
- -
- I think a lot of these ideas do help. Perhaps it's a matter of setting expectations. "This is awesome, rock out with it!" vs "You're trying to do something really hard, this thing will help mitigate the pain." - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:40 PM -
- -
- I now see that my prep notes actually say "OOP allows us to write larger programs" and that is definitely true troll - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:41 PM -
- -
- breaking down systems into components definitely helps with scaling things up, this is done all the time in hardware land, but components are not objects - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:41 PM -
- -
- I think the steelman version of this argument goes like this -1. OOP encourages you to assemble your program from many small objects, one per file -2. since each object has a single responsibility, individual changes that happen in the future usually belong in only one file -3. so even if you have 10k class files, only one matters at any given time -4. so you can scale your classes across your people - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:42 PM -
- -
- that's among the weaker steelmans I've seen - -
- - - - -
-
- 😂 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:42 PM -
- -
- and this is mostly true for changes like "instead of saying Hello Newcomer, it should say Howdy Stranger when the player logs in" - -
- - - - -
-
- 💯 - 1 -
-
-
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:42 PM -
- -
- you look up the PlayerGreeter.java - -
- - - - -
-
-
-
-
-
-
12:42
-
- -
- -
- you change the greeting - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:42 PM -
- -
- I do often find myself needing to modify multiple classes/files in a single tiny commit. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:43 PM -
- -
- For a while I used to have my build script show me the average number of files modified in the last 10 commits. That did give an interesting sort of peripheral awareness. - -
- - - - -
-
- 🤔 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:44 PM -
- -
- one thing that's important to note is that OOP makes changing the architecture rather hard, i.e. since objects store their references to other objects, you have to jump around everywhere to change things - -
- - - - -
-
-
-
-
-
-
12:44
-
- -
- -
- if you try to avoid this by using some pattern where an "upper level" object sets everything up - -
- - - - -
-
-
-
-
-
-
12:44
-
- -
- -
- you end up with way too much argument passing to constructors - -
- - - - -
-
-
-
-
-
-
12:44
-
- -
- -
- which, in turn, leads to awful dependency injection frameworks - -
- - - - -
-
-
-
-
-
-
12:45
-
- -
- -
- in most component-based design systems for hardware, the connections between the components are a directly editable thing - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:45 PM -
- -
- 💯 But then doesn't everything? I define architecture as "that which is hard to change." - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:45 PM -
- -
- That feels like it's mostly caused by the inheritance / taxonomy / hierarchy kinds of design problems we were talking about before - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 12:46 PM -
- -
- even with composition it's an issue, because of how communication between objects occurs - -
- - - - -
-
-
-
-
-
-
12:46
-
- -
- -
- i.e. For A to send messages to B, it needs to remember B - - (edited) -
- - - - -
-
-
-
-
-
-
12:46
-
- -
- -
- somehow, one way or another - -
- - - - -
-
-
-
-
-
-
12:46
-
- -
- -
- whereas in actual component-based systems, that "memory" is stored externally - -
- - - - -
-
-
-
-
-
-
12:46
-
- -
- -
- importantly, A does not own B here - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:46 PM -
- -
- sure, I guess I could see how it's a problem with "agency" ideas too - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:47 PM -
- -
- perhaps another thing worth noting here is that OOP overlapped with many general-good-practice "discoveries" and I think inherited some of their reputation, e.g. avoiding unnecessary globals - -
- - - - -
-
-
-
-
-
-
12:47
-
- -
- -
- (which OOP then undoes by inventing singletons :P) - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:48 PM -
- -
- I suppose so, yeah - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
SirWhinesalot
-
- -breaking down systems into components definitely helps with scaling things up, this is done all the time in hardware land, but components are not objects - -
-
-
- bvisness - - - 28-May-22 12:49 PM -
- -
- Going back to this, I would agree that breaking down systems into more-independent modules is certainly very important to solving larger problems; avoiding unnecessary globals is another example of a useful design tactic for tackling complexity - - (edited) -
- - - - -
-
-
-
-
-
-
12:49
-
- -
- -
- Was it really all that bad before OOP languages became popular though? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:49 PM -
- -
- All the fun there is in that word "unnecessary" 🙂 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:49 PM -
- -
- That might be too big a question 😛 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:50 PM -
- -
- well, OOP also largely coincided with the establishment of "programmer" as a known profession - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:50 PM -
- -
- Our programs did grow by several orders of magnitude in the period of the OO paradigm. I feel like it should take some of the credit/blame for that. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:50 PM -
- -
- indeed in the 80s it was common for people to conflate the "IT guy" with a programmer, and it was even riffed a bit in movies - -
- - - - -
-
-
-
-
-
-
12:51
-
- -
- -
- so I think it's hard to separate the professionalization of the field from the techniques that were popular at the time - -
- - - - -
-
-
-
-
-
-
12:51
-
- -
- -
- far fewer people were programming in the 80s - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:52 PM -
- -
- I suppose then that programming was just running into the very real problems of working with larger teams - - (edited) -
- - - - -
-
-
-
-
-
-
12:52
-
- -
- -
- "software engineering", to use Russ Cox's definition - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:52 PM -
- -
- yeah - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -I suppose then that programming was just running into the very real problems of working with larger teams - - (edited) -
-
-
- Kartik Agaram - - - 28-May-22 12:53 PM -
- -
- Oh very interesting, hadn't seen this before: https://research.swtch.com/vgo-eng - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:53 PM -
- -
- yep I was just gonna share the full quote: -
Software engineering is what happens to programming -when you add time and other programmers.
- -
- - - - -
-
-
-
-
-
-
12:54
-
- -
- -
- Is it fair to say that OOP languages offered some useful tools for "software engineering", but that those tools were misused? - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:55 PM -
- -
- I'd say Java/C++ offered the versions of various things that became popular (e.g. modularity was a general useful idea, and the way it came to the market was classes) - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Is it fair to say that OOP languages offered some useful tools for "software engineering", but that those tools were misused? - - (edited) -
-
-
- Kartik Agaram - - - 28-May-22 12:56 PM -
- -
- Yeah it feels like the nature of the world. You get some promises, you build something. You get some benefits, you get some problems you now have to live with. There's no going back. You can't enter a river twice. - -
- - - - -
-
-
-
-
-
-
12:56
-
- -
- -
- Even the bad parts, we had to explore them to understand why they're bad. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:56 PM -
- -
- it's worth trying to eliminate the "sturgeon contribution" (sturgeons law: 90% of everything is bad) - -
- - - - -
-
-
-
-
-
-
12:57
-
- -
- -
- a lot of bad stuff was done with OOP, but a lot of bad stuff would be done regardless - -
- - - - -
-
-
-
-
-
-
12:57
-
- -
- -
- so it's useful to think about what badness was imposed on top of the sturgeon fraction - -
- - - - -
-
-
-
-
-
-
12:57
-
- -
- -
- personally I think the "model the real world" thing is above-sturgeon badness - -
- - - - -
-
-
-
-
-
-
12:58
-
- -
- -
- it infected everything and everyone, it wasn't just the usual "most people do bad work" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:58 PM -
- -
- you could argue that it's a sturgeon-multiplier - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:58 PM -
- -
- yes quite plausible - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 12:58 PM -
- -
- it makes the 90% even worse 😛 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 12:58 PM -
- -
- I tend to think all the above-sturgeon badness came from social context. Mostly incentives. Hard to blame a tech paradigm for it. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 12:59 PM -
- -
- but the paradigm clearly invites some forms of badness - -
- - - - -
-
-
-
-
-
-
12:59
-
- -
- -
- and deserves blame for something it invites - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:00 PM -
- -
- so for example, the problems with modeling - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:00 PM -
- -
- I can't blame OOP for people applying it lazily or in a way that it doesn't invite, but I can absolutely blame it for people using it the way it advertises itself - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:01 PM -
- -
- you yourself did talk though about the level of marketing behind Java - so both factors are certainly in play - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:01 PM -
- -
- well ok but the thing that was marketed is not separable right? - -
- - - - -
-
-
-
-
-
-
13:01
-
- -
- -
- they didn't randomly choose something to promote, they chose that thing to promote - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:01 PM -
- -
- going from "I have this problem, how do I solve it with a combination of data structures and algorithms" to "how do I model these real-world concepts as agents with data + behavior" was one of the greatest mistakes we did as an industry - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:02 PM -
- -
- As an example, a nameless org I worked at was big on Design Patterns. But that was mostly caused by promotion incentives that reward complex-seeming work. I hate Design Patterns, but have a hard time blaming it for the ills created in its name. - -
- - - - -
-
- z_OOF - 2 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:02 PM -
- -
- ok but Design Patterns didn't say "you should base promotions on complex patterns" - -
- - - - -
-
-
-
-
-
-
13:02
-
- -
- -
- whereas OOP does say "you should have your program model concepts in the real world" - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:03 PM -
- -
- they (Design Patterns) were meant as a tool of communication, something to help explain what a certain structure in the code (that occurs often) is doing, but they turned into "best practices" somehow - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:03 PM -
- -
- True. I think I just give it some leeway as an honest mistake.. - -
- - - - -
-
-
-
-
-
-
13:04
-
- -
- -
- Design Patterns were also an honest mistake. They thought the problem they were solving was how to work in complex domains. The problem they turned out to solve was how to smuggle complexity and over-engineering into anything. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:05 PM -
- -
- I think they started from a very true and valuable observation, which is that code-as-characters-in-files reuse is [NOT] important compared to design reuse - - (edited) -
- - - - -
-
-
-
-
-
-
13:05
-
- -
- -
- that one insight was enough to persuade me to keep trying to find value in the book for years - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:05 PM -
- -
- this is Design Patterns, you mean? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:05 PM -
- -
- yeah - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:05 PM -
- -
- yeah that makes sense - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:06 PM -
- -
- if you already have a design of a solution you can reuse from the past, you're 80% done - -
- - - - -
-
-
-
-
-
-
13:06
-
- -
- -
- because most of programming is discovering a good-enough design - -
- - - - -
-
- 💯 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:06 PM -
- -
- Design Patterns are certainly useful. I.e. "I need to model sum types in this language that doesn't have them, how do I do it?" -> "Visitor Pattern, here's how you set it up" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:06 PM -
- -
- right well that's the Norvig argument, that design patterns are actually just papering over language deficiencies - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:07 PM -
- -
- they are 🙂 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:07 PM -
- -
- you don't need Command Pattern when you have first class functions - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:07 PM -
- -
- they're actually a great source of language design inspiration - -
- - - - -
-
-
-
-
-
-
13:07
-
- -
- -
- "how does your language avoid the need for this pattern" - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:08 PM -
- -
- yes and this would bring it back to the tried-and-true tradition of standardizing extant patterns of use - -
- - - - -
-
-
-
-
-
-
13:08
-
- -
- -
- just like the for-loop, or the mere method - -
- - - - -
-
-
-
-
-
-
13:08
-
- -
- -
- if you write an assembly program, you will at some point write what amounts to a for-loop - -
- - - - -
-
-
-
-
-
-
13:08
-
- -
- -
- so the language just makes that standard - -
- - - - -
-
-
-
-
-
-
13:08
-
- -
- -
- to the extent that can be done for design patterns I consider it useful - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:09 PM -
- -
- I think the problem was that "applying" design patterns somehow became a point of pride? which is silly? they're a shopping list of solutions to particular problems - -
- - - - -
-
-
-
-
-
-
13:09
-
- -
- -
- i.e. the more patterns in your code the better - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:09 PM -
- -
- yes, well ... this would be far afield but this is tied to bigtech interviewing/hiring practices in the late 90s - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:10 PM -
- -
- oh man - -
- - - - -
-
- 😄 - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:10 PM -
- -
- in the same way universities need a thing to teach as a theory of programming, tech companies needed a thing they could quiz - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:10 PM -
- -
- as much as I would love to crack the coding interview right now, we are past the three-hour mark and I think it would be a good idea to step back and summarize what we've discussed today - -
- - - - -
-
-
-
-
-
-
13:11
-
- -
- -
- although that would be a great subject for continued discussion afterward - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- demetrispanos - - - 28-May-22 01:11 PM -
- -
- yes I agree it's too far a tangent - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:11 PM -
- -
- perhaps a future fishbowl, since it's not really OOP specific - -
- - - - -
-
-
-
-
-
-
13:11
-
- -
- -
- but also a problem - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:11 PM -
- -
- definitely - -
- - - - -
-
-
-
-
-
-
13:12
-
- -
- -
- So here's my summary of what we've covered: -- "OOP is when you associate behavior with data": This is present in OOP, but not really the heart of the issue. That is, just because you have methods doesn't necessarily mean you have anything more than simple procedural programming with some syntax sugar. -- "OOP models the real world": This is categorically not true or effective, no matter what language you use. The real world resists taxonomy, and doesn't have anything to do with the problems you are solving. -- "OOP is Java": Well, we didn't say it as such, but we did discuss many of the specific problems of Java, and the promises it failed to live up to, despite its takeover of industry. -- "OOP as a model of computation": This idea was appealing largely because of promises of independent components and easy reuse - but arguably OOP is worse at providing this than other programming paradigms (especially the Java flavor of OOP). -- "OOP tackles complexity": There are some good concepts, such as modularity and avoiding globals, that became popular along with OOP languages, but OOP itself makes things more complex. - - (edited) -
- - - - -
-
-
-
-
-
-
13:13
-
- -
- -
- Is this a fair representation or am I leaving things out? - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:13 PM -
- -
- I'd been writing a summary as well over the conversation, and it is much more instrumental, through the lens of "how to write better programs" - -- if you have lots of one kind of thing, give them a common template -- when building a program, take a moment to plan such schemas first -- as a schema proves valuable, rework it to be more timeless. This includes making it easy to change the memory layout, but much more. - -Some rules of thumb like these capture all that is valuable about OO, to my mind. And what programming languages can contribute here are late-binding capabilities that preserve optionality for the programmer. - -What they don't capture is the hardest problem of all: how you can preserve an executable, checkable model of the world that acts as a history of why your program is as it is. - -Tests are one way to do that. Formal models are another, though formal models can also be used for modeling solutions rather than contexts. Prose documents are a third. They have limitations, but they're better than nothing to a future code archeologist. - -A lot of the ills we see with OO dogma lie in the space between my rules of thumb. You have to wait until you understand a domain before you try to generalize. OO languages are particularly bad here, because you're forced to create classes literally on line 1. - -I think design as a general activity makes no sense. Good design comes from understanding a domain. It is by necessity domain-specific. - -And any design activity really has to have a certain level of humility. Pick a bounded problem. Interact with few peers (that themselves have humility in dependencies and goals). Keep things coherent rather than trying to optimize the whole ocean into paperclips. - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Is this a fair representation or am I leaving things out? - -
-
-
- SirWhinesalot - - - 28-May-22 01:14 PM -
- -
- just that if we split interfaces/vtables from OO, and maybe the nice subject verb object syntax, there's nothing of use left - -
- - - - -
-
-
-
-
-
-
13:16
-
- -
- -
- I'm willing to leave interfaces/vtables as being "OO", as the one useful thing it has, because they are damn useful when you need them - -
- - - - -
-
- ❤️ - 1 -
-
-
-
-
-
-
-
-
13:17
-
- -
- -
- but other people disagree that they're even "OO", since stuff like modules in SML have many similarities without the runtime dispatch for example, and there are many ways to do runtime dispatch that are not interface based - - (edited) -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:19 PM -
- -
- So in that case...I'd like to return to the original age-old question: "is OOP bad or what?" - -It sounds like the prevailing opinion here is that: -- Object-oriented programming is fundamentally an approach to modeling and design, not merely some nice syntax in your language -- Object-oriented design is fundamentally flawed, since the idea of solving problems by modeling the world is fundamentally flawed -- The flaws of object-oriented design also prevent OOP from being a useful model of computation, or from meaningfully tackling complexity - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:19 PM -
- -
- that's my view on the matter yes - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:19 PM -
- -
-
A lot of the ills we see with OO dogma lie in the space between my rules of thumb. You have to wait until you understand a domain before you try to generalize. OO languages are particularly bad here, because you're forced to create classes literally on line 1. - -I think design as a general activity makes no sense. Good design comes from understanding a domain. It is by necessity domain-specific. -
And I appreciate these thoughts by @Kartik Agaram a lot.
- -
- - - - -
-
-
-
-
-
-
13:20
-
- -
- -
- Not only does object-oriented design fail to model problems well, but the tools force you into bad designs immediately. - -
- - - - -
-
-
-
- - - -
-
-
-
-
- Avatar -
- -
-
- Avatar -
bvisness
-
- -Not only does object-oriented design fail to model problems well, but the tools force you into bad designs immediately. - -
-
-
- demetrispanos - - - 28-May-22 01:21 PM -
- -
- yes in particular "in what class does this activity belong?" is a useless question that has wasted an enormous amount of time - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:20 PM -
- -
- btw, just to answer the question I posted when I did my design introduction - -
- - - - -
-
-
-
-
-
-
13:21
-
- -
- -
- What is the single responsibility of the Customer class? - - (edited) -
- - - - -
-
-
-
-
-
-
13:21
-
- -
- -
- it is to uniquely identify a customer, it's a primary key - -
- - - - -
-
-
-
-
-
-
13:21
-
- -
- -
- here's a Customer class in Odin - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:21 PM -
- -
-
Customer :: distinct u64
- -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:22 PM -
- -
- I think I can also reasonably conclude that, while OOP languages and practices may contain some good ideas, those are mostly unrelated to the core of object-oriented design. - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:24 PM -
- -
- I think "ownership" should maybe go in another fishbowl as well, since it has some similar issues with rigid tree-like structures and assigning "agency" to bits of data - -
- - - - -
-
-
-
-
-
-
13:24
-
- -
- -
- ownership is quite central to OOP - -
- - - - -
-
-
-
-
-
-
13:24
-
- -
- -
- even in GC languages - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:24 PM -
- -
- because there's a distinction between an object that "contains" another object within itself, and an object that "knows" about another object - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:25 PM -
- -
- in Rust there's a syntactical distinction, but in Java there isn't - -
- - - - -
-
-
-
-
-
-
- Avatar -
- -
-
- gingerBill - - - 28-May-22 01:24 PM -
- -
- Ownership semantics is surprisingly related to OOP from an ontological perspective - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:25 PM -
- -
- and there we have massive tangent #2 - -
- - - - -
-
-
-
- - - - - - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:25 PM -
- -
- But yeah I agree that it could be a valuable topic to fishbowl about someday. - -
- - - - -
-
-
-
-
-
-
13:26
-
- -
- -
- Thanks @Kartik Agaram for the summary thoughts - are there any other summary thoughts our other participants would like to provide before we close? - -
- - - - -
-
- ❤️ - 1 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:26 PM -
- - - - - - -
-
-
-
-
-
-
13:26
-
- -
- -
- so I'll shut up now 😛 - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:27 PM -
- -
- Thanks everyone for this introduction to the fishbowl format. I'm a huge convert, to the extent that I think we should stop having in-person conferences. - -
- - - - -
-
- 😂 - 3 -
-
- AbnerHangry - 3 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:28 PM -
- -
- Thank you very much for participating! I am really glad we finally had the opportunity to discuss this topic thoroughly. - -
- - - - -
-
-
-
-
-
-
13:29
-
- -
- -
- Thank you all for helping me with my secret moderator agenda of being able to say "before you discuss OOP any further, read this conversation" 😈 - -
- - - - -
-
- brain - 6 -
-
-
-
-
-
-
-
-
13:30
-
- -
- -
- I hope everyone found the conversation useful, that it helps you understand OOP better, and that it helps you understand how to write better programs. - -
- - - - -
-
-
-
-
-
-
13:31
-
- -
- -
- See you in a couple months for our next fishbowl! - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- Kartik Agaram - - - 28-May-22 01:31 PM -
- -
- Thank you @bvisness for organizing! - -
- - - - -
-
- coolben - 2 -
-
-
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- SirWhinesalot - - - 28-May-22 01:32 PM -
- -
- Indeed, thanks a lot @bvisness , and also thank you to all the participants - -
- - - - -
-
-
-
- - - -
-
-
-
- Avatar -
- -
-
- bvisness - - - 28-May-22 01:36 PM -
- - - - - - -
-
-
-
- - -
diff --git a/src/templates/src/include/header.html b/src/templates/src/include/header.html index 4d46c69..419bb36 100644 --- a/src/templates/src/include/header.html +++ b/src/templates/src/include/header.html @@ -91,7 +91,7 @@ diff --git a/src/templates/src/landing.html b/src/templates/src/landing.html index 1d9b007..45c43a6 100644 --- a/src/templates/src/landing.html +++ b/src/templates/src/landing.html @@ -169,7 +169,7 @@ @@ -220,7 +220,7 @@

Community Showcase

- This is a selection of recent work done by community members. Want to participate? Join us on Discord. + This is a selection of recent work done by community members. Want to participate? Join us on Discord.
diff --git a/src/templates/src/wheeljam_index.html b/src/templates/src/wheeljam_index.html index 1ef17af..2ca44da 100644 --- a/src/templates/src/wheeljam_index.html +++ b/src/templates/src/wheeljam_index.html @@ -243,7 +243,7 @@
@@ -263,7 +263,7 @@

Showcase

- These screenshots and videos were shared in #jam-showcase on our Discord. Join us! + These screenshots and videos were shared in #jam-showcase on our Discord. Join us!

diff --git a/src/templates/types.go b/src/templates/types.go index 6a1591d..33e9c6d 100644 --- a/src/templates/types.go +++ b/src/templates/types.go @@ -338,7 +338,6 @@ type ImageSelectorData struct { type Breadcrumb struct { Name, Url string - Current bool } type Pagination struct { diff --git a/src/website/fishbowl.go b/src/website/fishbowl.go index fa706e2..08bdc24 100644 --- a/src/website/fishbowl.go +++ b/src/website/fishbowl.go @@ -1,20 +1,104 @@ package website import ( - "errors" + "fmt" "html/template" "io" "io/fs" "net/http" - "path" "strings" + "time" + "git.handmade.network/hmn/hmn/src/hmnurl" "git.handmade.network/hmn/hmn/src/oops" "git.handmade.network/hmn/hmn/src/templates" "git.handmade.network/hmn/hmn/src/utils" ) +// This will skip the common path prefix for fishbowl files. +// We unfortunately need to do this because we want to use http.FileServer, +// but _that_ needs an http.FS, but _that_ needs an fs.FS... +var fishbowlFS = utils.Must1(fs.Sub(templates.FishbowlFS, "src/fishbowls")) +var fishbowlHTTPFS = http.StripPrefix("/fishbowl", http.FileServer(http.FS(fishbowlFS))) + +type fishbowlInfo struct { + Slug string + Title string + Month time.Month + Year int + ContentsPath string +} + +var fishbowls = [...]fishbowlInfo{ + { + Slug: "internet-os", + Title: "The future of operating systems in an Internet world", + Month: time.May, Year: 2020, + }, + { + Slug: "metaprogramming", + Title: "Compile-time introspection and metaprogramming", + Month: time.June, Year: 2020, + }, + { + Slug: "lisp-jam", + Title: "Lessons from the LISP Jam", + Month: time.August, Year: 2020, + }, + { + Slug: "parallel-programming", + Title: "Approaches to parallel programming", + Month: time.November, Year: 2020, + }, + { + Slug: "skimming", + Title: "Code skimmability as the root cause for bad code structure decisions", // real snappy, this one + Month: time.January, Year: 2021, + }, + { + Slug: "config", + Title: "How to design to avoid configuration", + Month: time.March, Year: 2021, + }, + { + Slug: "simplicity-performance", + Title: "The relationship of simplicity and performance", + Month: time.May, Year: 2021, + }, + { + Slug: "teaching-software", + Title: "How software development is taught", + Month: time.June, Year: 2021, + }, + { + Slug: "flexible-software", + Title: "How to design flexible software", + Month: time.December, Year: 2021, + }, + { + Slug: "oop", + Title: "What, if anything, is OOP?", + Month: time.May, Year: 2022, + ContentsPath: "oop/OOP.html", + }, +} + func FishbowlIndex(c *RequestContext) ResponseData { + type fishbowlTmpl struct { + Date string + Title string + Url string + } + + var fishbowlTmpls []fishbowlTmpl + for _, f := range fishbowls { + fishbowlTmpls = append(fishbowlTmpls, fishbowlTmpl{ + Date: fmt.Sprintf("%s %d", f.Month.String(), f.Year), + Title: f.Title, + Url: hmnurl.BuildFishbowl(f.Slug), + }) + } + var res ResponseData err := res.WriteTemplate("fishbowl_index.html", getBaseData(c, "Fishbowls", nil), c.Perf) if err != nil { @@ -24,8 +108,18 @@ func FishbowlIndex(c *RequestContext) ResponseData { } func Fishbowl(c *RequestContext) ResponseData { - // Only serve up valid fishbowls - if _, err := fs.Stat(fishbowlFS, c.PathParams["name"]); errors.Is(err, fs.ErrNotExist) { + slug := c.PathParams["slug"] + var info fishbowlInfo + + // Only serve up valid fishbowls (with content) + exists := false + for _, fishbowl := range fishbowls { + if fishbowl.Slug == slug && fishbowl.ContentsPath != "" { + exists = true + info = fishbowl + } + } + if !exists { return FourOhFour(c) } @@ -36,14 +130,21 @@ func Fishbowl(c *RequestContext) ResponseData { type FishbowlData struct { templates.BaseData + Slug string + Info fishbowlInfo Contents template.HTML } - indexFile := utils.Must1(fishbowlFS.Open(path.Join(c.PathParams["name"], "index.html"))) + contentsFile := utils.Must1(fishbowlFS.Open(info.ContentsPath)) tmpl := FishbowlData{ - BaseData: getBaseData(c, "TODOOP", nil), - Contents: template.HTML(utils.Must1(io.ReadAll(indexFile))), + BaseData: getBaseData(c, info.Title, []templates.Breadcrumb{ + {Name: "Fishbowls", Url: hmnurl.BuildFishbowlIndex()}, + {Name: info.Title, Url: hmnurl.BuildFishbowl(slug)}, + }), + Slug: slug, + Info: info, + Contents: template.HTML(utils.Must1(io.ReadAll(contentsFile))), } var res ResponseData @@ -54,13 +155,6 @@ func Fishbowl(c *RequestContext) ResponseData { return res } -// This will skip the common path prefix for fishbowl files. -// We unfortunately need to do this because we want to use http.FileServer, -// but _that_ needs an http.FS, but _that_ needs an fs.FS, and embed.FS -// doesn't import fs.SubFS, which _would_ do what we want, so here we are. >:( -var fishbowlFS = utils.Must1(fs.Sub(templates.FishbowlFS, "src/fishbowls")) -var fishbowlHTTPFS = http.StripPrefix("/fishbowl", http.FileServer(http.FS(fishbowlFS))) - func FishbowlFiles(c *RequestContext) ResponseData { var res ResponseData fishbowlHTTPFS.ServeHTTP(&res, c.Req)