• 0 Posts
  • 93 Comments
Joined 1 year ago
cake
Cake day: June 21st, 2023

help-circle

  • I think it’s good to document why things are done, but extracting things out into another function is just documenting what is being done with extra steps. This also comes with a number of problems:

    1. Not all languages are readable. Documenting what is being done is important in some C, or when working with some libraries that have confusing usage syntax.
    2. Not all people reading the code know the language or libraries well. Those people need guidance to understand what the code is trying to do. Function names can of course do this, but…
    3. Not all types can be named in all languages. Some languages have a concept of “opaque types”, which explicitly have no name. If parameter and return types must be specified in that language, working around that restriction may result in unnecessarily complicated code.
    4. Longer files (the result of having dozens of single-use functions) are less readable. Related logic is now detached into pointers that go all over the file all because of an allergic reaction to code comments, where a simple // or # would have made the code just as readable.
    5. Function names can be just as outdated as code comments. Both require upkeep. Speaking from personal experience, I’ve seen some truly misleading/incorrect function names.




  • For library code - yes, you’d usually want to direct users to the correct way of using the library, so you’d be more likely to come across fallible build functions or a bunch of type parameters to constrain when it can be called.

    For applications - honestly, it’s your code, so do what makes sense to you. Using a build function can help you ensure your settings were fully configured before using them, but it’s up to you if that’s the direction that makes the most sense to you. One benefit is you only need to perform the check once, but the downside is having another “built” type that you need to keep in sync with the original type. You can also look at libraries like derive_builder if you want to have your builder generated for you to avoid needing to manually update two separate types.




  • Speaking as someone with a MTF close friend and NB spouse, but the term used in the article is the term everyone around me used when I was growing up. That term may be obsolete now, and if so, the author simply needs to be informed. There’s no need to assume they meant harm by it.

    If they knowingly used a term that may offend, then that’s of course a separate issue.


  • In addition to 1:many, many:many, and many:1 (which is just 1:many but looking at it in the other direction), you also occasionally see 1:1, for example if you want to augment a table with additional data. This might be done by having your foreign key also be your primary key in the augmenting table, since that would also enforce a uniqueness constraint on the FK as a result.

    Also, probably unnecessary to mention, but you can also have “0 or 1” relationship (meaning one side is optional but capped at 1). These are technically separated from “1” relationships usually when you get into all the theory. An example of this might be a “0:1” relationship using the above augment table, but where the augmenting table isn’t required to have a row for every row in the augmented table. (A 1:1 constraint can be enforced, for example, by having an additional FK in the augmented table pointing to the augmenting table.)




  • If you want to use it in your start menu, there are some options. I know Start11 can use Everything, for example (but isn’t free - there may be free options out there, but I haven’t looked).

    Otherwise, most of what I’ve seen are CLI applications. Is there anything specific about Windows you’re hoping to see a replacement for? For me, search and settings (why the f are you advertising to me in the f-ing settings?) are the worst offenders, but settings is kinda locked in for the most part unfortunately.


  • We have infused AI into every layer of Windows

    I sure hope not. I don’t want Windows to just decide to delete my hard drive because it feels like it.

    We are introducing Windows Semantic Index, a new OS capability which redefines search on Windows and powers new experiences like Recall.

    You could also improve Windows search by contracting with voidtools and integrating Everything. While you’re at it, maybe ditch the bing searches, and other useless search results?

    Anyway, the rest of the article seems to go into actual dev-oriented details, and there’s some interesting bits like enabling certain AI acceleration features on the web (probably only in Edge though…), for what that’s worth.





  • I’ve used GitLab and Azure DevOps professionally, but there are a lot of services out there which host Git repositories. GitLab can also be self-hosted which is nice. They all fundamentally work the same though from my experience - code viewer, issue tracker, pull requests, some way of doing CI/CD, and various collaborative and documentation features (wikis, discussion areas, permission management, etc).

    It may be good to understand also where the separation lies between features that are part of Git vs those which are part of the service you’re using (like GitHub). For example, branches are Git, while pull requests and wikis are GitHub.



  • TehPers@beehaw.orgtoProgramming@programming.dev...
    link
    fedilink
    English
    arrow-up
    5
    ·
    4 months ago

    I’ve been writing Lua off and on for probably close to a decade, and I can’t remember the lack of a round function being an issue. I may have needed it at some point, but it’s not exactly a complicated function to write up in a minute.

    To me, the biggest appeal of Lua is actually the lack of an overbearing standard library. It has just enough to be usable as a scripting language within a larger application, and the larger application can always include its own helper library that gets loaded into the interpreter automatically on initialization. Feature-wise, there is enough to define your own OOP helpers (but no language built-in specific OOP stuff beyond metatables basically), there is enough to build your own async/await and generators using coroutines, etc.

    Not having a huge built-in standard lib comes with the benefit of not needing to distribute a huge standard lib with your larger application.