So, I see that my blog is the one place I forgot to announced that I’ve accepted the position of Software Engineer at 2K Sports to work with the NBA 2K team. Oh well. So, yeah, that’s pretty much it. Expect more about that soon. (I’m really excited about it, magnitudes more than this first paragraph shows, but this is not exactly the reason for this post.)
However, not everyone took that too well. There’s a lot of people using the tools I created for NBA 2K12 and 2K13, and they’re disappointed to see me go and stop developing game-specific tools (other tools like NBA Stats Tracker and Hex on Steroids I’ll still work on as a hobby whenever time allows). However, since all my work is open-source, there’s nothing stopping you, any of you, to grab the source code, edit it to your heart’s content, compile and re-release. There’s even a project that I know people were waiting for, namely Roster Workshop, which was to be 2K13’s equivalent of last year’s Roster Merge & Repair, improved and with a whole lot of new features, that never got released with how things turned out. Still, nothing stopping you from releasing it and keeping on working on it. Any of my tools.
This will seem like the most obvious tip ever, but I thought I’d get it out there for those that may have forgotten about it in a while. If you’ve ran out of ideas on what to work on your project next (i.e. you have no new features or improvements in mind), try going through your codebase and find the oldest pieces of it. (Side note: Having your codebase be in something like a Git repository that can tell you when each line of code was committed and thus last edited can be amazingly helpful.) Chances are you’ve grown since then. You’re a better developer. You have more tricks up your sleeve. Maybe you know of a new algorithm, a new library, a new, better way to do things. Maybe you’ve read about security risks you weren’t aware of. There’s almost definitely going to be something there that could use some tidying up, some improvement.
Look for redundancies, variables or parameters that seemed helpful at the time, but now seem obviously unneeded. Look for opportunities to refactor, to optimize, to parallelize. Look for possible security risks, replace unsafe procedures and methods with safer ones. Maybe try doing a whole piece of code from scratch.
So, continuing my Q&A with the user from the NLSC forums, he asked me two things. One, it was his first time that he saw someone access a class property directly, like so:
instance.property = newValue
And of course it hit me, that the proper way is for properties in classes to be private, and to provide get/set methods to the users if need be. Getting used to the automatic properties and fields of C# makes you forget about stuff like that. And that can only help emphasize my point about not learning a “modern” programming language first.
Regarding the first part, you can use instance.property = something (e.g. mycar.Make = “Volvo”) as long as you set the property to public. The “correct” programming practice says that you set all properties to private, and only give access to them IF YOU WANT to the user through methods, like so:
Continuing my last post, that user from the NLSC forums said he didn’t understand the “this” keyword the way it was explained through the video tutorials. Although I’m 100% sure there’s many people out there, way more experienced than I am, explaining this particular keyword, I thought I’d write an answer of my own. Why? Well, if I say I want to be a teacher, I should be able to explain any programming concept that comes up in words that a person that’s beginning programming would understand. (And if I don’t know a concept, I should not be afraid to say so, read up on it, and come up with a good explanation. A teacher that admits he/she doesn’t know everything is way more useful to their students and their approach to programming, than one that makes up bullshit on the spot to cover-up what he/she doesn’t know, and ends up filling their brains with false knowledge.)
So, here’s my explanation on the very first things one should know about the “this” keyword.