So, at work, we're working on this site for this company, and it's built on this software called "CommunityServer", which can be found at communityserver.org . The thing that pisses me off isn't necessarily to do with that software package, but in software in general, but it's most relevant with that software right now, because it's what I'm using.
Anyway, so many factors end up determining if something is "visible" or not. For instance, in Community Server, it might be a certain "forum". So, a forum might not be visible if the user isn't logged in, if the user isn't in a certain role, if the forum is the private messages forum. Or, it could be an email address, and it's shown to users logged in who also show their email address, or not shown if no user is logged in, or shown to admin. Et Cetera. There's tons of different variables that might determine if something is shown or not. Which is not my problem. It becomes a problem when you inherit this huge software application, and you have to make something behave just like other stuff that's already on the site.
This can also determine other states of an object, like is it editable? Does it get this certain process applied to it, like if certain versions of it X months old should be deleted, can it be printed, does it have a history, can it be part of an RSS or Atom feed, does it have an image with it? Etc, etc, etc. Tons of other things that could all be generalized, and shouldn't have to be figured out in every single instance.
Alright, maybe their software is poorly designed. I never said it wasn't :) But what I'd love to be able to do is, basically, not have to do anything, as a developer, and have it act like other things like it, whatever it is. I don't want to have to specify that, when selecting it from the database, that the "IsPrivate" bit must be set to 0, and that the "IsDeleted" bit must be set to 0. These aren't necessarily the fields, but examples. Also, I don't want to have to specify that the user has to be in the group that the forum belongs to in order to see it.
When I write software, I make it as easy as I can to write later on down the road. There's two ways to go about software development. #1, get the job done, which is how 99% of software is designed / developed. #2 is then, get it done but make it easier to add / change / remove stuff later on down the road. Software is, in fact, never done. It is a fact, a truth, a tautology. There is always something to add that can make it better. But 99% of the software written out there is so finalized when version 1.0 is out the door. Making changes is, for all intents and purposes, a f@%@#$ing pain in the ass.
Forget that it's never documented. That I can deal with. I can read code like a PhD can read a children's book. Although, it's a lot harder to tell what something *is* versus what something *does*. If you were looking at an engine for a blender, but you know you might find the same type of engine in, say, an electrical drill. You can tell that it probably turns something very fast, but you don't know what it is from the high level. Until you see it in motion. So, the code, along with the running version of the application, I can figure it out. Although, I can still read code like a pro. I am a pro after all :P
Anyway, if there was a way to define behavior in an object, without having to specify and filter and code for every possible variation, my life would be a lot easier. The sad thing is, I can think of hundreds of ways, because my mind has been conditioned, through years of hating to write code, to come up with the simplest, most developer friendly solution possible. I'd create interfaces! Object Oriented Programming is the best. An interface for "this might be private", or "this should be filtered for a role", and "this could only pertain to certain users", and "this could be deleted", etc. You just tag your objects with these interfaces and voila! No code!! Your filter logic would be in your data access layer... "if (obj instanceof IDeletable) then don't get deleted ones." Of course, this application doesn't even make it possible for me to modify this without having to put in hundreds of hours of work into it, and that's simply not an option. Stupid software.
Anyway, time for bed. Got some errands to run before the game tomorrow!