jump to navigation

My Post Is Biased And I Am A Horrible Coder April 16, 2011

Posted by ismywebsite in general.
trackback

Here are the awful design decisions which I made.

1) Broke things down, with logical divisions.
Users are the same as groups of users, and should be treated as such. All the methods to deal with a huge group of users need to go mixed in with the methods to deal with only one.

There’s no logical or important security distinctions between what a client should be able to do and what an administrator should be able to do. We should let client level classes have full reign to do anything.

Finally, there should not be a handy center class. It’s just awful when the whole work of listing, paginating, and allowing commands to be applied to multiple of an item, are already coded and just need to be customized. It just takes so much fun away from building it yourself by hand every time.

2) I automated design pattern coding.
Blind to the fact that one of the simple pleasures in life is coding a very similar thing over and over again, and blind to the absolutely vast quantity of time which we have available to do this, I made the awful design decision to automate a set of base classes.

Not just one, but one for every single type of data we deal with. Users, websites, messages. All of them are automatically generated with a horrible base class that does all the basic stuff. Like if I want to get your username, change your credit balance, etc… I only have the fun of calling a method in this class. Common functions like getters, setters, search, and new object creation should be hand coded.

Not only did I have the base classes automated, but I designed the system so it can be updated if any data structures change, by just running one single script. This deprived developers of the joy of finding all those affected piece of code and manually changing them. As Brendan pointed out, “if it was ‘easy’ then everyone would do it.” Clearly everyone is not doing it, so it’s therefore harder.

3) I made shortcuts for coding.
HTML is such a beautiful language, with it’s long link syntax. I mean it’s just so elegant:

<a href=”mynewpage”>Link Title</a>

Who in their right mind would want the option to type the following instead?

<<mynewpage Link Title>>

It’s only a lot shorter. Again, including a script is also a lot of fun and a very elegant process:

<php include “script-folder/myscript.php”; ?>

What on Earth was I thinking when I created this syntax?

{myscript}

To top it all off, not only did I create all these confusing shortcut options, but I made it so there was an even more confusing way to recompile. You had to pass a confusing and hard to remember one letter handle to the page, like this:

http://www.ismywebsite.net/mypage?r=1

So not only did I deprive from the fun of typing elegant code, but I made this awful torture bottleneck system.

4) I added lots of whitespace.
We all know that computer memory is so incredibly expensive. I mean, I constantly am running out of space because I use an extra space or new line in my files.

We should all look up to the minimal version of JQuery! Now that (deliberately compact) gem is how we should all be coding server-side code, especially in a large project with over 100,000 lines of it. Why bother wasting space formatting anything? It doesn’t take THAT much longer to understand what’s going on, and even if it does, that’s because the reader is stupid.

Honestly, what primitive mind sees text that is closer together as more closely related? I mean, that’s one of those archaic design principals that only apply to cavemen and not to the real geniuses of the world. Why on Earth would it even be better to group things into visual logical steps. And oh the horror, use whitespace to separate those steps…

And an operator is directly part of the numbers on either side! I mean in that case of 1==1, it shouldn’t be 1 == 1, since the 1 is part of the equals. They are completely 100% the same. Because 1equals1. Youknowitstrue. Don’tdenyit. And honestly, thebytesareexpensive. You can all read that just as easily (unless you’re stupid), so spaces here are unnecessary. Imagine the $$$ I just saved the WordPress platform in this paragraph alone.

We all know that every one of you knows how to set the tab length on your editor programs, but for a stupid person like myself, or a lazy person who doesn’t want to do that every single time they switch computers, it isn’t at all any issue when at 5 levels deep, a full quarter of 80 character width is wasted (with 4 spaces). If you come from an even more outdated version with tabs = 8 spaces, then boo on you since half the screen is wasted. But of course, this isn’t fair since we all are exclusively 100% only doing coding. It should be full screen, and there shouldn’t need to be any space for windows beside it, so 80 characters is not a fair width. Besides, even if we do multi-task, larger monitors and desk space are dirt cheap compared to the cost of the extra bytes. So we can all just upgrade.

That’s right, I am even so insane that I prefer two spaces over tabs for line spacing. Please, somebody get me checked in!

Advertisements

Comments»

1. mr glasses - April 16, 2011

Just a wee bit caustic…

2. Hostify Networks - April 16, 2011

It sounds like you haven’t specified clear coding standards that your developers should follow. I can send you a sample of how this document should look if you’d like.

Also, considering my prior experiences with these folks, I think it’s pretty safe to say this “revolution” won’t get very far. Go ahead with your code fixes, Matt.

3. ismywebsite - April 16, 2011

1) I have specified them. It’s not much help if I have to spend more time understanding the code than I save not having to write it. Here’s a sample of the document:

http://www.ismywebsite.com/v/Coding_Guidelines.txt

I did at one point compromise with John that it would be tabs instead of double spaces, and he agreed to adopt the rest.

2) They’ve made more progress in ~7 days than 3 (1/2) months. If they keep accelerating at that pace, maybe they could make it… Miracles do happen from time to time. ;P

Hostify Networks - April 16, 2011

1) If you have to spend more time trying to understand it than you would spend writing it then there’s certainly something wrong. The possibilities that spring to my mind are poorly commented code and/or poorly written code. Clearer coding guidelines and peer review should help with that at least a little bit.

Care to share any samples of your “bad” code? I don’t really remember what your code looks like and I’m sure it’s changed a lot since I last saw it. The only really horrible thing I remember was the structure of the ads table in the database…a new column for each type of ad is a big no-no in database design land. I’m not sure about anything else since I really didn’t touch it that much.

It was only “bad” for me since I was just dipping my toes into PHP and there wasn’t much documentation in the code itself. Basically, I was completely lost and the weird naming scheme didn’t help (a, b, c, d file names for example). I imagine it wouldn’t be much of a problem now since I have built up a few years of experience and now actually know how to code and can pick up new languages fairly quickly.

I suppose that brings up another question…how experienced are your developers? If they’re only novices, your code will most certainly be scary to them. Assigning them to simpler tasks could help them gain more knowledge and enable them to work their way up.

I was really impressed by the guidelines a colleague sent me to look over so I’ll go ahead and send them to you. Note that it’s not technically supposed to be distributed, but feel free to copy and paste bits and pieces that you feel are relevant. It does differ a bit from what you have outlined, but the recommendations really do make a huge difference in code readability and speed of development.

2) This may turn out okay if they properly planned the project. Have they shared their plans with you? If I were in this situation, I would be interested in seeing the ERD and DFD as well as all the alternatives they reviewed before deciding to start from nothing. If they don’t have proper plans or aren’t sticking to their plans, I would be very worried. Of course, just the fact that I was left out would cause me to be very worried. I do tend to worry too much (and don’t think miracles happen), however. 😉

You could look at all of this from another perspective… If they are competent enough to pull this off, you’ll be able to concentrate on actually running the site rather than doing damage control all the time. However, you might as well fix any bugs in the current system that are causing problems for clients (or can’t be easily worked around) just in case this new thing doesn’t release on time/work out.

Hostify Networks - April 16, 2011

Or maybe I won’t…

Delivery to the following recipient failed permanently:

mmcgirr@ismywebsite.com

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 No Such User Here (state 14).

J,R,D, Ltd - May 8, 2011

What does “ERD” and “DFD” stand for?

Hostify Networks - May 10, 2011

Basically, these are essential components of designing a system in an intelligent way. If you ever take a Project Management or Database course, you’ll learn all about these things and how they integrate into systems development (and then you’ll wonder how you ever designed a system without using them). 🙂

Wikipedia can explain it much better than I:
ERD: http://en.wikipedia.org/wiki/Entity-relationship_model

DFD: http://en.wikipedia.org/wiki/Data_flow_diagram

4. J,R,D, Ltd - April 17, 2011

I think you were a little mad when you posted this…

Deltik - April 17, 2011

He was very mad. 😉

J,R,D, Ltd - April 17, 2011

I hope he isn’t still mad…

NickoCP - April 18, 2011

Oh yes.

Jesus - April 18, 2011

Is that ‘Oh yes – he is’?

J,R,D, Ltd - April 18, 2011

How many people are on the development team?

Deltik - April 18, 2011

Four

J,R,D, Ltd - April 20, 2011

Well no wonder you guys can get a lot more done in a lot less time then Matt can, he has to work to support himself and IMW and then be IMW’s head, doesn’t leave much time for coding.

5. lyudmil - April 18, 2011

I guess no one has seen a ‘perfect code’, especially in very complicated systems. And then, tastes vary. Для вкус и цвет товарищи нет (For taste and colour, there are no comrades) the Russians say.

6. ismywebsite - April 18, 2011

There will be no mercy if the project fails.

Deltik - April 18, 2011

Okay.

J,R,D, Ltd - April 24, 2011

How is the project coming along?

7. NickoCP - April 21, 2011

*cough* Website accept please o.O *cough*

8. J,R,D, Ltd - April 23, 2011

Is anyone else getting a 500 error on Node 7?

Deltik - April 23, 2011

Node 7 has been giving HTTP 500 Errors for clients with no determined pattern. I have no idea what is going on. Perhaps an administrator can help.

J,R,D, Ltd - April 24, 2011

So there is probably nothing I can do to fix it? I can’t even put up an error page for the 500 error.

9. J,R,D, Ltd - April 25, 2011

It seems to be fixed now! Was anything changed on the server? Or did it just fix itself?

10. Jasen - The IMW God - April 25, 2011

Wow, am I glad I was fired with all the other volunteers. Gives me more incentive to not come back.

Matt and the rest need to stop being babies and just get the damn coding done. Seriously, it’s not rocket science. It’s not even ASP. It’s PHP. How hard could it be?

ismywebsite - April 25, 2011

Well, I’m barred from building IMW 5. The whole thing is being done on another server which I have no access to. As far as I know, there are 4 developers hard at work and still on schedule. If they want to take the project off my hands, and seem to have the drive to not give up on it, then I’m not going to wasting any more time fighting it.

11. J,R,D, Ltd - April 28, 2011

When is the release date?

Deltik - April 29, 2011

We will let you know when the time comes.

J,R,D, Ltd - April 29, 2011

Ahh, ok…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: