• 0 posts
  • 7 comments
Joined 3 years ago
Cake day: June 9th, 2023
  • How much time do you have to program in edge cases? If I had the time and it were me, I’d parse for single number and return a single element. A single number with colon would give the front/back portion of the list accordingly. And two numbers gives the inclusive range.

    Then in terms of if you get a zero, swap to zero index mode since they clearly want the start of the list or reject the command explaining the argument isn’t zero-based (probably best to reject just for consistency).

    The docs/help page will be key here. That and consistency across your app when it comes to zero vs one indexing.

  • I think it would depend on the typical user base and how the rest of the cli operates. If it’s typical array work or your users are typically programmers or otherwise know computing, then stick to 0 based indexing. If they’re users of spreadsheets and rarely interface with zero-based indicies, then stick to what they know. Just document it well enough for everyone!

    I’d also think inclusive is more intuitive. If they only want one element, then they can provide the single element, otherwise they get the full range.

    Although, if your cli is trying to mimic another programming function. If it’s very clear that’s the intent, then follow the functionality of the parent function.

  • Another vote for Porkbun here. I switched after Google Domains shared they were selling off to Squarespace. It’s been a lovely experience and their website just seems more human than the other big players. Cloudflare isn’t a terrible alternative option as long as you’ll be using their DNS.

  • The class keyword exists for a reason and it has a perfectly fine use case when you need to make use of creating new objects. I think it may be disliked because people come over from Java assuming you need to define everything as objects/classes when we have modules and other methods of doing the same thing with a little bit less clutter. I recommend reading up on the underlying functionality and how classes and objects work compared to modules.