This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-14
Channels
- # aleph (3)
- # announcements (1)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (62)
- # biff (2)
- # calva (13)
- # cider (4)
- # clj-kondo (6)
- # cljdoc (17)
- # clojure (142)
- # clojure-dev (6)
- # clojure-europe (62)
- # clojurescript (20)
- # core-async (26)
- # cursive (18)
- # data-oriented-programming (9)
- # data-science (1)
- # datahike (18)
- # events (4)
- # fulcro (4)
- # graalvm (2)
- # hyperfiddle (15)
- # interop (1)
- # jobs-discuss (8)
- # leiningen (2)
- # lsp (91)
- # malli (1)
- # missionary (11)
- # nbb (65)
- # off-topic (50)
- # practicalli (2)
- # programming-beginners (4)
- # re-frame (18)
- # remote-jobs (1)
- # shadow-cljs (53)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-build (63)
- # web-security (1)
- # xtdb (15)
Hey! Data oriented programming might be the most valuable idea I've learned working with Clojure, that I've been able to transfer to other languages. DOP has changed how I approach Python, Javascript, Go and Java. Now I'm looking to learn C. My motivation for learning C is: • To learn how computer memory works • To learn how to write programs that use the memory effectively, to achieve better performance then when working with objects • To learn how to work with big datasets • Perhaps even learn some graphics. --- I have an impression that it's possible to apply data oriented programming to C too. It's structs and functions, right? Therefore: Do you have learning resources to recommend when I want to write C with data-orientation in mind? Thanks! 😄
I'm considering https://www.goodreads.com/en/book/show/13136685-learn-c-the-hard-way by Zed Shaw.
@teodorlu Can you share some details about the way you applied DOP in Java? Is it aligned with what I present in the appendix about Java in my book?
I haven't read your appendix. I might have to! In short: 1. Consider just using hash maps and lists instead of "everything is an object" 2. When making classes, make them trivial to convert from/to JSON 3. When making classes, make them small and immutable. Consider using dataclasses.
I've either just used a map, or gone the "reflection" route with Gson or Jackson. I haven't really encountered the need to treat the objects as maps. If I were to do that, I guess I could just convert to Json and then convert to a map. My primary benefit in Java has simply been "less object stuff". Represent a domain entity with an immutable object, done. Don't write setters. Then try to build a "language" for working with those domain objects in a way that makes sense.
C has no objects, no class system, no built-in hash maps or lists, unless you implement them yourself from the constructs that C does provide.
It is certainly possible to write pure functions in C, but in idiomatic C, they are the exception, I would say.