Better HN
topnewbestaskshowjobs
Log inSign up

codemonkey-zeta

648 karma · joined May 1, 2020 (6y ago) · 196 submissions

Submissions

comment 3mo ago · link · parent

I'm glad to see the first thing you mentioned was the value of purchasing software.

For some reason software developers are particularly averse to paying for software, even when it pays for itself.

My current company spent over $10k + at least a month of developer salary building an OKR app for the company, so probably in total $25k. One look at the SaaS landscape there would have revealed plenty of $5/mo/seat solutions that would take DECADES to break even with the investment we already made. To add insult to injury, the app was vibe-coded and barely works.

In my experience, software that wants to help you is cheap. Software that wants to _trap_ you (Salesforce, Oracle, the Cloud) is expensive, and any software you write yourself falls into the latter category by default (you own it, you maintain it).

comment 4mo ago · link · parent

Indeed, the article mentions Wikipedia experiencing similar scraping pains, even though they already DO have bulk data available.

comment 4mo ago · link · parent

The maps haven't changed at all, this is a feature at destructuring sites.

comment 5mo ago · link · parent

> The mess just moves

That's exactly the point. The author recognizes that people will extract components, and that is exactly why tailwind is attractive.

Plain CSS offers a componentization layer over (mostly) classes, but modern SPA frameworks offer their own componentization layers over functions. It's annoying and error-prone to keep these 2 layers, and lots of devs just abandon CSS for utility class mess. It's just a different choice.

comment 5mo ago · link · parent

I like the framing of organizational slack as immune system, instead of fat, and I emphatically agree with the author.

> ...“slack”: unbooked time that isn’t already spoken for. It’s always the first casualty, because it’s treated as a nicety... because it looks like waste...

> But that’s not what slack is. Slack is the only reason anything that comes up ever gets acted on. It’s what lets people take that signal that something is wrong, figure out why it’s happening, and then solve it... Without slack, the signal still arrives, everybody’s just too busy to pick up the phone or listen to the backlog of voicemails.

> [The AI playbook] gets this infuriatingly backwards: it treats slack as the thing AI lets you eliminate. If the tools make us faster, why do we still need buffer time?

> Getting rid of it at the time you’re flooding the system with machine-generated code you don’t fully understand removes the mechanism to absorb something we know will happen: it will surprise you.

> You didn’t cut fat. It was never fat. You cut your organization’s immune system.

comment 5mo ago · link · parent

Nope, splitting green wood is much more difficult than splitting dried logs, so I often cut a tree in the spring, stack the rounds, then split those rounds in the fall.

People overestimate how dry wood needs to be to burn correctly. Just have some ultra-dry kindling (seasoned for 2+ years) and you won't have any problems.

On the contrary, I know some folks who let all their wood dry too far, and it burned way too hot and ruined their stove (and almost burned their house down).

comment 8mo ago · link · parent

> for reasons that nobody can articulate

This is only true if you ignore the role of America's greatest ally, in which case, the motivations become very obvious.

comment 9mo ago · link · parent

You assume the stone is released along a circular path, but that isn't quite right. When you release the stone you extend your arm forward, changing the arc of travel.

comment 9mo ago · link · parent

Nice blog! However, when I hear timeline, I want to see a timeline. This is an article ordered by time, which is much less interesting, and very long.

comment 10mo ago · link · parent

I'm a big fan of Dustin, I think the programming interface electric presents is very compelling, and the benefits are really impressive.

The killer feature, for me, of electric is that it makes the network _transparent_ to me, the programmer, and makes solving complex problems concise.

I see electric as a kind of emacs - an excellent operating system that lacks a decent front-end. Reactive programming is hard, and it really ought to be way more visual, and electric should give me those tools.

I find the frontend side of the electric somewhat obtuse, and it's easy to go off the rails, needing to understand the underlying reactive layer https://github.com/leonoel/missionary. Why should I target this bizarre DSL when there are millions of React, Angular, JQuery apps out there that work, and would be too onerous to adapt to this style of programming, and too annoying to carry a second framework in prod (even if you bundle an electric app in your existing one, the runtime can be very big by web standards). I would love to see a framework built on top of electric that interfaces with any existing frontend as easily as it does now for any backend (Datomic is just one target of many for the spreadsheet Dustin built). I may try to explore this idea myself.

But is the business of Hyperfiddle building instances of this new hypermedia, or the hypermedia system itself? I don't understand exactly what Dustin is selling me, at the end. Trying to sell this particular spreadsheet as a solution, or is it access to the runtime (electric 3)? How am I supposed to buy into a new programming model if I cannot use it?

11.

A Datomic entity browser for prod [video](youtube.com ↗)

4 points · by codemonkey-zeta · 10mo ago · 1 comment

comment 10mo ago · link · parent

I find that Lisps encourage this behavior more than other languages. Many (most?) of the lisp functions I read have the exact same structure:

  (fn some-function [args]
    (let [binding (transform args)]
      (an-expression binding)))
I find that this makes skimming lisp code much easier, because I can usually skip reading the bindings and just read the function name and ultimate expression and usually get the gist very quickly.

You might wonder how this is different than the example you provided, and the answer is because you could sneakily intersperse anything you wanted between your imperative bindings (like a conditional return statement), so I actually have to read every line of your code, vs in a lisp `let` I know for a fact there is nothing sneaky going on.

comment 10mo ago · link · parent

deps.edn is becoming the default choice, yes. I interpreted the parent comment as saying "you will see advice to use leiningen (even though newer solutions exist, simply because it _was_ the default choice when the articles were written)"

comment 11mo ago · link · parent

Can you describe how rsc allows you to avoid rest endpoints? Are you just putting your rsc server directly on top of your database?

comment 11mo ago · link · parent

Except it wasn't $12B to farmers. Farmers have been squeezed by monopolies on both the supplier (seed, equipment, etc) side AND the buyer side (there is often only a single buyer of grain in an area, for example) to the point that most large scale American farms are struggling to make any profit, and service their sizeable debts. The $12B will immediately be transferred to these monopolies, it will not go to farmers.

comment 1y ago · link · parent

This is a great place to start! https://clojure.org/about/history

comment 1y ago · link · parent

To be clear, there's nothing wrong with your approach, and many people implement systems exactly the way you are describing in Clojure using Records (which are Java classes).

  (defrecord UserLoginView [email password])

  ;; DIFFERENCE: compile-time validation
  (defn login [^UserLoginView view]
    (authenticate (:email view) (:password view)))

  ;; Usage
  (let [user-data {:user/email "user@example.com"
                   :user/password-hash "hash123"
                   :user/address "123 Main St"
                   :user/purchase-history []}

        ;; DIFFERENCE: construct the intermediary data structure - ignore extra stuff explicitly
        login-view (->UserLoginView
                     (:user/email user-data)
                     (:user/password-hash user-data))]
    (login login-view))


I prefer not to work this way though. The spec-driven alternative could be:

  (require '[clojure.spec.alpha :as s])
  (require '[clojure.spec.gen.alpha :as gen])

  (s/def :user.login/email string?)
  (s/def :user.login/password-hash string?)
  (s/def :user.login/credentials
     (s/keys :req [:user.login/email ;; spec's compose
                   :user.login/password-hash]))

  (defn login [credentials]
    ;; DIFFERENCE: runtime validation
    {:pre [(s/valid? :user.login/credentials credentials)]}
    (authenticate (:user.login/email credentials)
                  (:user.login/password-hash credentials)))

  (let [user-data {:user.login/email "user@example.com"
                   :user.login/password-hash "hash123"
                   :user/address "123 Main St"  
                   :user/purchase-history []}]
    ;; DIFFERENCE: extra data ignored implicitly
    (login user-data))

  ;; Can also pass a minimal map
  (login {:user.login/email "user@example.com"
          :user.login/password-hash "hash123"})

  ;; or you can generate the data (only possible because spec is a runtime construct)
  (let [user-data 
        (gen/generate (s/gen :user.login/credentials)) ; evaluates to #:user.login{:email "cWC1t3", :password-hash "Ok85cHMP5Bhrd4Lzx"}
        ]
    (login user-data))

The drawbacks of Records are the same for Objects - Records couple data structure to behavior (they're Java classes with methods), while spec separates validation from data, giving you:

- generative testing (with clojure.spec.gen.alpha/generate)

  You say "it makes sense to unit test logins using every conceivable variation of `UserLoginView`", well, with spec you can actually *do that*:

  (require '[clojure.test.check.properties :as prop])
  (require '[clojure.test.check.clojure-test :refer [defspec]])

  (defspec login-always-returns-session 100
    (prop/for-all [creds (s/gen :user.login/credentials)]
      (let [result (login creds)]
        (s/valid? :user.session/token result))))

  This is impossible with Records/Objects - you can't generate arbitrary Record instances without custom generators.
- function instrumentation (with clojure.spec.test.alpha/instrument)

- automatic failure case minimization (with clojure.spec.alpha/explain + explain-data)

- data normalization / coercion (with clojure.spec.alpha/conform)

- easier refactoring - You can change specs without changing data structures

- serialization is free - maps already serialize, whereas you have to implement it with Records.

Plus you get to leverage the million other functions that already work on maps, because they are the fundamental data structure in Clojure. You just don't have to create the intermediate record, let your data be data.

comment 1y ago · link · parent

> you trade away your ability to make structural guarantees about which functions depend on which fields

You might make this trade off using map keys like strings or keywords, but not if you use namespace qualified keywords like ::my-namespace/id, in combination with something like spec.alpha or malli, in which case you can easily make those structural guarantees in a way that is more expressive than an ordinary type system.

comment 1y ago · link · parent

Author is on the verge of having a Clojure epiphany.

> 1. You should often be using different objects in different contexts.

This is because "data" are just "facts" that your application has observed. Different facts are relevant in different circumstances. The User class in my application may be very similar to the User class in your application, they may even have identical "login" implementations, but neither captures the "essence" of a "User", because the set of facts one could observe about Users is unbounded, and combinatorially explosive. This holds for subsets of facts as well. Maybe our login method only cares about a User's email address and password, but to support all the other stuff in our app, we have to either: 1. Pass along every piece of data and behavior the entire app specifies 2. Create another data object that captures only the facts that login cares about (e.g. a LoginPayload object, or a LoginUser object, Credential object, etc.)

Option 1 is a nightmare because refactoring requires taking into consideration ALL usages of the object, regardless of whether or not the changes are relevant to the caller. Option 2 sucks because your Object hierarchy is combinatorial on the number of distinct _callers_. That's why it is so hard to refactor large systems programmed in this style.

> 3. The classes get huge and painful.

The author observed the combinatorial explosion of facts!

If you have a rich information landscape that is relevant to your application, you are going to have a bad time if you try modeling it with Data Objects. Full stop.

See Rich Hickey's talks, but in particular this section about the shortcomings of data objects compared to plain data structures (maps in this case).

https://www.youtube.com/watch?v=aSEQfqNYNAc

comment 1y ago · link · parent

The absolute best resource I've found for educating myself about this topic is John Vervaeke's free online course "Awakening from the meaning crisis". You can search it in YouTube or Spotify.

He explains in detail exactly why a "nostalgic return to religion" cannot save us from, not just nihilism, but the entire set of crises western society is undergoing.

comment 1y ago · link · parent

I think the surface area for bugs in a C++ dependency is way bigger than a JS one. Pulling in a new node module is not going to segfault my app, for example.

comment 1y ago · link · parent

I'm coming to the unfortunate realizattion that supply chain attacks like this are simply baked into the modern JavaScript ecosystem. Vendoring can mitigate your immediate exposure, but does not solve this problem.

These attacks may just be the final push I needed to take server rendering (without js) more seriously. The HTMX folks convinced me that I can get REALLY far without any JavaScript, and my apps will probably be faster and less janky anyway.

comment 1y ago · link · parent

I also had this thought, until I then saw the Greek statues in museums that the Romans were trying to emulate!

comment 1y ago · link · parent

That package _does_ just run it in vterm, and it just adds automatic code links (the @path/to/file syntax), and a few more conveniences.

comment 1y ago · link · parent

Maybe I don't understand, but I thought the whole point of datomic (and XTDB by extension) was to avoid denormalization.

I am surprised the author says:

> "Old Yakread" has a lot of slow queries. For example, loading the subscriptions page on my account takes more than 10 seconds: for each of my hundreds of subscriptions, it has to run a query to figure out how many unread posts there are and when the most recent post was published.

I would have thought you would grab all this data in a single query roughly like this:

  ;; Assuming XTDB v1.19+ or v2
  (def q
    '{:find  [?sub-id ?unread-count ?last-pub]
      :in    [user-id]
      :where [[?sub :subscription/user user-id]
              [?sub :subscription/feed feed-id]
              ;; join to posts in that feed
              [?post :post/feed feed-id]
              [?post :post/published timestamp]
              (not [?post :post/read-by user-id])
      ]
      :find  [(count ?post) ?unread-count
              (max timestamp) ?last-pub]
      :order-by [[?last-pub :desc]]})

^ AI disclaimer, but I think it gets the gist, you do your logical joins right in the query

comment 1y ago · link · parent

I agree that this is the approach that keeps react apps simple. The biggest problems I see in react code are giant components that read like this:

useState

useState

useState

... // 20 more

useEffect

useEffect

useEffect

... // 20 more

I think a lot of front-end devs don't realize the necessity of custom hooks for composition and modularization. My personal rule is "Never use react hooks (useState, useEffect, etc.) in component code. All react hooks MUST be wrapped by custom hooks." and it makes for MUCH better code:

useSomeData

useOtherData

useMobileView

useScrollToTop

useInteractionLogging

... // 10 more hooks

This is also what makes TanStack so good and popular. It's all just behavior wrapped in hooks.

comment 1y ago · link · parent

If you're interested in that, read up on Shakerism, a now almost-extinct branch of Quakerism that had an even stronger focus on mysticism.

comment 1y ago · link · parent

> Because most of my day-to-day is in clojure I tend to use sonnet 4 to get the parens right.

In case the author is lurking, you may want to apply the same fix they do in clojure-mcp: https://github.com/bhauman/clojure-mcp/blob/8150b855282babcd...

The insight that team had was that LLMs get confused with parens, but they are excellent at indentation, so if you run parinfer over the LLMs output it will be correct in 99% of cases.

1234567