• 0 Posts
  • 39 Comments
Joined 2 years ago
cake
Cake day: May 16th, 2024

help-circle
  • If you think I have any interest in personal squabbles over 8 lines of code, I don’t.
    That meme at the start was directed at your argument, not you in particular; those are not the same thing. I apologise if it came across as personal to you, but it wasn’t meant to be. Notice how I immediately went to discuss the actual topic with no further “personal attacks” until you decided to get pissy with your next comment. Had you just shrugged and actually wrote your counterpoint instead, that would’ve been the end of it. You didn’t. Just… you know, if you wanna go around being snarky on the internet, be prepared to receive some snark back as well.

    With that said, I think the argument about uutils’ license is a much more sound one. As a matter of fact I expressed the same concern a over year ago, albeit in a much less elaborate fashion: https://lem.lemmy.blahaj.zone/post/23171431/13400085 (Which of course I didn’t expect you to dig up because that’d be absurd)
    I’m not a big fan of uutils, believe it or not. It’s not nearly as stable as they tout it to be, they broke cp recently as an example, and it’s is generally not a step in the right direction IMO. Still, the fact that uutils may be ill conceived doesn’t invalidate the fact that relying on public, official, C APIs is perfectly reasonable. Both can be true.
    Had this post been about the license instead of “oh look the hypocrites use C APIs in the end” as if there was any alternative, we wouldn’t be having this conversation.











  • And I know much of it is not necessarily the fault of the devs, with management and deadlines preventing them from doing the best possible job, I myself was forced to release half broken updates a few times because of that, but they are not the only problem.

    There’s a real problem in today’s programming culture with thinking that computers are so fast, any garbage code you write will be fast enough, or that you only need to optimize the hot path. Apply that philosophy throughout all your codebase, and suddenly there is no hot path, everything runs like shit. People should also actually learn how things work, not just frameworks, otherwise they won’t be able to make informed decisions about what they write.

    Also stuff like “Clean Code” and other similarly dogmatic principles still permeate many of the codebases I see. Nigh implementable jungles of <10 lines long functions and OOP garbage that make working with everything a massive pain, other than making every function call virtual and thrashing performance. You need to maintain such a massive amount of context in your head just to figure out the flow of a particular piece of code, with the aid of a debugger because everything is done through abstract classes or interfaces, that even making the smallest change becomes a tedious and error prone task.

    Also fuck dynamically typed languages. They suck, every single one of them.


  • No it just makes me even more frustrated. The amount of incompetence and neglect I see and have to deal with on a daily basis, even with software developed by multi-million dollar corporations, is astonishing.

    Why is modern webdev such a clusterfuck? Why does VisualStudio take multiple seconds to open an empty project? Why does Nvidia’s control panel have multiple seconds long pauses to switch between settings categories or loading lists? Why does this game run like garbage on a 4090 when it has mostly static environments and the graphics aren’t even that good?

    I could go on but I’d be here all day. All of those things, with the exception of webdev (because god there’s so much shit in there…), could be easily fixed* or should’ve never gotten that bad in the first place.

    *Provided the entire architecture isn’t garbage, otherwise see the rest of the sentence…





  • I’ve found working with Rust and Bevy to be quite pleasant. If you’re used to working with ECS, I suggest you at least give it a go.
    Rust is as functional as C++ 20 with ranges and views is, which is to say it isn’t. Not sure where you got that impression from, but while it does borrow some ideas from functional languages, it’s still very much a procedural one.

    Zig doesn’t have headers, nor inheritance. Again, not sure where you got that from, but Zig is basically a modern C, so there’s no OOP anywhere, let alone multiple inheritance.

    As for what to use, I think they’re both viable alternatives. I lean more towards Rust, but that’s just due to familiarity. Odin also looks like a viable option, if you don’t mind a smaller ecosystem.
    If you want a garbage collected language, then I’d go for C#. Despite its historic reputation as a Windows only language, it’s been cross platform and open source for roughly a decade at this point. I find it great to work with.




  • Oh for sure. I have nothing against getters and setters when they’re justified, but in the case of bare fields with no validation like that example it’s just annoying.
    Also stuff like this just grinds my gears (oversimplified example again):

    class IntegerAdder {
        private int a, b;
        public IntegerAdder(int a, int b) {
            this.a = a;
            this.b = b;
        }
        
        public int get_sum() {
            return a + b;
        }
    }
    

    Just make it a bloody function.
    You may say it’s silly, but I’ve genuinely found code like this in the wild. Not that exact code snippet of course but that was the spirit.


  • It really depends on the context frankly. I did say it was a crappy example ;)
    Try to read this snippet I stole from Clean Code and tell me if it’s readable without having to uselessly jump everywhere to understand what’s going on:

    public class SetupTeardownIncluder {
      private PageData pageData;
      private boolean isSuite;
      private WikiPage testPage;
      private StringBuffer newPageContent;
      private PageCrawler pageCrawler;
    
    
      public static String render(PageData pageData) throws Exception {
        return render(pageData, false);
      }
    
      public static String render(PageData pageData, boolean isSuite) throws Exception {
        return new SetupTeardownIncluder(pageData).render(isSuite);
      }
    
      private SetupTeardownIncluder(PageData pageData) {
        this.pageData = pageData;
        testPage = pageData.getWikiPage();
        pageCrawler = testPage.getPageCrawler();
        newPageContent = new StringBuffer();
      }
    
      private String render(boolean isSuite) throws Exception {
         this.isSuite = isSuite;
        if (isTestPage())
          includeSetupAndTeardownPages();
        return pageData.getHtml();
      }
    
      private boolean isTestPage() throws Exception {
        return pageData.hasAttribute("Test");
      }
    
      private void includeSetupAndTeardownPages() throws Exception {
        includeSetupPages();
        includePageContent();
        includeTeardownPages();
        updatePageContent();
      }
    
    
      private void includeSetupPages() throws Exception {
        if (isSuite)
          includeSuiteSetupPage();
        includeSetupPage();
      }
    
      private void includeSuiteSetupPage() throws Exception {
        include(SuiteResponder.SUITE_SETUP_NAME, "-setup");
      }
    
      private void includeSetupPage() throws Exception {
        include("SetUp", "-setup");
      }
    
      private void includePageContent() throws Exception {
        newPageContent.append(pageData.getContent());
      }
    
      private void includeTeardownPages() throws Exception {
        includeTeardownPage();
        if (isSuite)
          includeSuiteTeardownPage();
      }
    
      private void includeTeardownPage() throws Exception {
        include("TearDown", "-teardown");
      }
    
      private void includeSuiteTeardownPage() throws Exception {
        include(SuiteResponder.SUITE_TEARDOWN_NAME, "-teardown");
      }
    
      private void updatePageContent() throws Exception {
        pageData.setContent(newPageContent.toString());
      }
    
      private void include(String pageName, String arg) throws Exception {
        WikiPage inheritedPage = findInheritedPage(pageName);
        if (inheritedPage != null) {
          String pagePathName = getPathNameForPage(inheritedPage);
          buildIncludeDirective(pagePathName, arg);
        }
      }
    
      private WikiPage findInheritedPage(String pageName) throws Exception {
        return PageCrawlerImpl.getInheritedPage(pageName, testPage);
      }
    
      private String getPathNameForPage(WikiPage page) throws Exception {
        WikiPagePath pagePath = pageCrawler.getFullPath(page);
        return PathParser.render(pagePath);
      }
    
      private void buildIncludeDirective(String pagePathName, String arg) {
        newPageContent
          .append("\n!include ")
          .append(arg)
          .append(" .")
          .append(pagePathName)
          .append("\n");
      }
    }
    

    That’s what I was talking about.