• 1 Post
  • 66 Comments
Joined 2 years ago
cake
Cake day: June 14th, 2023

help-circle

  • addie@feddit.uktocats@lemmy.worldHome invader
    link
    fedilink
    arrow-up
    8
    ·
    8 days ago

    Ah, but that is my cat. We call him Tux, our neighbours called him Boots. We’ve a ‘street whatsapp’ channel for arguing over the bins and getting to the bottom of who’s cat has rocked up in who’s house. Number of times I’ve seen a familiar moggy on an unfamiliar bedspread.

    Cats, man. You might think you own them, but if anything, you own them for a while.



  • Enough of that crazy talk - plainly WheeledDeviceServiceFactoryBeanImpl is where the dependency injection annotations are placed. If you can decide what the code does without stepping through it with a debugger, and any backtrace doesn’t have at least two hundred lines of Spring boot, then plainly it isn’t enterprise enough.

    Fair enough, though. You can write stupid overly-abstract shit in any language, but Java does encourage it.



  • Well now. My primary exposure to Go would be using it to take first place in my company’s ‘Advent of Code’ several years ago, in order to see what it was like, after which I’ve been pleased never to have to use it again. Some of our teams have used it to provide microservices - REST APIs that do database queries, some lightweight logic, and conversion to and from JSON - and my experience of working with that is that they’ve inexplicably managed to scatter all the logic among dozens of files, for what might be done with 80 lines of Python. I suspect the problem in that case is the developers, though.

    It has some good aspects - I like how easy it is to do a static build that can be deployed in a container.

    The actual language itself I find fairly abominable. The lack of exceptions means that error handling is all through everything, and not necessarily any better than other modern languages. The lack of overloads means that you’ll have multiple definitions of eg. Math.min cluttering things up. I don’t think the container classes are particularly good. The implementation of pointers seems solely implemented to let you have null pointer exceptions, it’s a pointless wart.

    If what you’re wanting to code is the kind of thing that Google do, in the exact same way that Google do it, and you have a team of hipsters who all know how it works, then it may be a fine choice. Otherwise I would probably recommend using something else.


  • I feel that Python is a bit of a ‘Microsoft Word’ of languages. Your own scripts are obviously completely fine, using a sensible and pragmatic selection of the language features in a robust fashion, but everyone else’s are absurd collections of hacks that fall to pieces at the first modification.

    To an extent, ‘other people’s C++ / Bash scripts’ have the same problem. I’m usually okay with ‘other people’s Java’, which to me is one of the big selling points of the language - the slight wordiness and lack of ‘really stupid shit’ makes collaboration easier.

    Now, a Python script that’s more than about two pages long? That makes me question its utility. The ‘duck typing’ everywhere makes any code that you can’t ‘keep in your head’ very difficult to reason about.


  • Frezik has a good answer for SQL.

    In theory, Ansible should be used for creating ‘playbooks’ listing the packages and configuration files which are present on a server or collection of servers, and then ‘playing the playbook’ arranges it so that those servers exist and are configured as you specified. You shouldn’t really care how that is achieved; it is declarative.

    However, in practice it has input, output, loops, conditional branching, and the ability to execute subtasks recursively. (In fact, it can quite difficult to stop people from using those features, since ‘declarative’ doesn’t necessarily come easily to everyone, and it makes for very messy config.) I think those are all the features required for Turing equivalence?

    Being able to deploy a whole fleet of servers in a very straightfoward way comes as close to the ‘infinite memory’ requirement as any programming language can get, although you do need basically infinite money to do that on a cloud service.





  • addie@feddit.uktoMemes@sopuli.xyzRIP obsolete tech
    link
    fedilink
    arrow-up
    3
    ·
    2 months ago

    We used to do that in industrial automation. If you make any changes to the PLC / HMI / SCADA software, burn a DVD with what you changed and leave it next to the rack. No danger of bringing in viruses on a USB stick (the whole system was air-gapped) and you’d still have a backup available.





  • From a UK perspective, a lot of US cars would be illegal to drive on public roads here - too large, too dangerous for pedestrians and other road users. “Dangerous” also applies to some of your other potential exports too. Chlorinated chicken, for instance, isn’t considered safe for consumption. So the absence of a market for those goods isn’t simply “customer preference”.

    As a European, we’ve been too dependent on the US on some things for too long. We need to be more independent. The situation in Ukraine has shown that; we need to be able to support our allies better. But the US trashing their own economy, making themselves into global pariahs and handing over their superpower status to China is what I would have described as “not my dream way” of achieving that.


  • A binary tree is one way of preparing data, usually for sorting. Each node can have a left, right, or both, children.

      A
     / \
    B   C
       / \
      D   E
    

    “Inverting the tree” means swapping the children for each node, so that the order that the nodes are visited is reversed. Depending on whether you want to copy the tree or swap it in place then the algorithm is different. C++ provides iterators too, so providing a “order reversed” iterator can be done efficiently as well.

    You’re going to have to visit every node and do at least one swap for every node, and an efficient algorithm won’t do much more than that. Bring unable to do it suggests that the student programmer doesn’t understand stacks or recursion yet, so they’ve more to learn.





  • To be fair, compiling C code with a C++ compiler gets you all the warnings from C++'s strong-typing rules. That’s a big bonus for me, even if it only highlights the areas of your C that are likely to become a maintenance hazard - all those void* casts want some documentation about what assumptions make them safe. Clang will compile variable-length arrays in C++, so you might want to switch off that warning since you’ve probably intended it. Just means that you can’t use designated initialisers, since C++ uses constructors for that and there’s no C equivalent. I’d be happy describing code that compiles in either situation as “C+”.

    Also stops anyone using auto, constexpr or nullptr as variable names, which will help if you want to copy-paste some well-tested code into a different project later.