Not a lot of useful, thought out content this time (like every time really, but that’s another point), just a few quick things that I’ve run into over the past few weeks that are worth noting for future reference.
Remember kids, when you assume, you make null pointer exceptions and index out of bounds exceptions. Always check variables you’re getting from somewhere else for actual data before you use them, especially if it’s from a database or user input. Sure, everything works just fine now, but later on that particular record won’t have data, even though it’s always supposed to, and you’re going to end up crashing something. Save yourself the heartache, and just do a simple null/empty check.
Remember kids, NoSQL databases don’t mean there’s no schema at all, it just means the database isn’t enforcing one. Instead, your code is what’s enforcing any schema. Sure, you could huff and puff about that defeating the point of a “schemaless” database, and not enforce anything in the code, but you better be making no assumptions whatsoever about what’s in the records you get back from your queries (see above). Oh, and good luck finding records in the first place. Not only is there no consistency to what fields are in your data (not even a bare minimum other than the primary key field), there’s no telling what kind of data you’re dealing with so there’s no telling how to format it for querying (do you cast it to a string, or put it in an object, or what?). Stop pretending that you don’t have to pay attention to what’s going into your NoSQL database, and remember that there’s no such thing as a purely “schemaless” database.
Remember kids, updating a database directly from the pointer to query results leads to bad things (like 100 extra records in the database). Actually, updating any list of stuff directly from a pointer to the list tends to lead to bad things, and should really be avoided altogether.
Folders starting with a “.” are probably hidden for a reason, and you probably shouldn’t mess with them unless you have a complete understanding of what they’re for. Not following that particular piece of advice bricked my work computer for days and was a massive pain in the butt. Make sure you understand just what those hidden folders are doing before you figure you can just clear them out to free up some space.