logoalt Hacker News

coldteayesterday at 8:58 PM1 replyview on HN

>It still produces subpar code, with horrendous data access patterns, endless duplication of fucntionality etc

Not really. 2024 called.


Replies

troupoyesterday at 9:48 PM

Just because you don't look at the code, doesn't mean it doesn't produce subpar code constantly.

Opus 4.7, high effort. Literally 30 minutes ago. There's a `const UNMATCHED_MARKER = "<hardcoded value>"` that we want to remove from a file. Behold (the first version was a full on AST walk for absolutely no reason whatsoever, by the way):

      function restoreUnmatchedSelectors(cssPath) {
          const cssContent = readFileSync(cssPath, "utf-8");
          const marker = UNMATCHED_MARKER + " ";
          const count = (cssContent.match(new RegExp(escapeRegExp(marker), "g")) || []).length;          
          if (count > 0) {
              writeFileSync(cssPath, cssContent.replaceAll(marker, ""));
              return count;
          }
      }

      function escapeRegExp(s) {
          return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
      }


Don't get me started on all the code duplications, utility functions written from scratch in every module that needs them, reading full database just to count number of records...
show 1 reply