Be a Supporter!

Developers Ranting Thread

  • 1,262 Views
  • 41 Replies
New Topic Respond to this Topic
FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Developers Ranting Thread Dec. 18th, 2012 @ 09:57 AM Reply

Lately, I've found some things frustrating as a Web Developer/Web Programmer. I realized that there are many others who, like me, find things that they need to rant about sometimes ... to get things off their chest, so to speak. This thread serves two purposes. First, it will help developers get things off their chest in a good rant. Second, others might know of a resolution or have suggestions that may help the developer in their current situation. That being said, I will go first with two rants.

Rant 1:

Customers. I have a love/hate relationship with customers. Could someone explain to me why customers, after a deadline is set, wait until the last second to get you all the content that you need to complete their website? You spend all night the day before a site is supposed to go live making sure you put all the content in place, making sure everything is styled properly, making sure all the links work, etc. While the customer is at home enjoying their children, you're having an all nighter because they couldn't get the information you needed earlier in the development process. Customer's, I would like you to have a special "You are a f****** moron" episode. Gosh, I hate you guys ... but you're necessary for me to make my cash!

Rant 2:

Facebook, why did you add a security measure to your "Recommend/Like" buttons? If too many "suspicious" requests are sent to FB, the Recommend button becomes a "Confirm Link." FB, you really piss me off!!!!!!!! This isn't suspicious activity, but the work of developers in progress making sure things are in place for their clients. Did you fall off planet retard? Oh my gosh, I could so kick social networking in its metaphoric crotch! GRRRRR!!!!!!

End of rants.

^_^ Thank you!


BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Developers Ranting Thread Dec. 18th, 2012 @ 02:40 PM Reply

I am frustrated by APIs that name list implementations SomethingArray, call it a SomethingList if it has an O(n) accessor.
I am also frustrated by some loose interpretation of standards that make me wonder why a 32 x 32 png is displayed as a 42 x 42 icon.
/rant

Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 19th, 2012 @ 09:19 AM Reply

Internet explorer. Enough said on that subject I think.

Another thing I found annoying particularly when working at a marketing agency is having to produce code to "get the job done". Many times have I had to resort to writing absolutely shameful crap code to meet the ever-changing requirements of the client. Or clients signing off stuff, only to come back after launch at 10pm on a friday because they found something that didn't quite work right.

shudder

This last one is probably just because I'm overly anal about it, but when working with others on the same codebase: inconsistent code style. When doing code reviews I just want to point out there should be a space between the if and the parentheses, or between the parentheses after the function name and the opening brace, and so forth.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 19th, 2012 @ 12:38 PM Reply

At 12/19/12 09:19 AM, Mich wrote: Internet explorer. Enough said on that subject I think.

I thought everyone loved IE? ;) Hehe, I love Silktide's cover photo on FB. "We love IE so much we want it to bask in the warmth of a blast furnace."

Another thing I found annoying particularly when working at a marketing agency is having to produce code to "get the job done". Many times have I had to resort to writing absolutely shameful crap code to meet the ever-changing requirements of the client.

I think we've all had to resort to writing terrible code to "get the job done" like hard coding things that shouldn't be hard coded, etc. This also goes back to my statement about a special episode "You're a f****** moron" for customers, because that's exactly what they are sometimes. Well, actually, all the time, but we won't go there.

This last one is probably just because I'm overly anal about it, but when working with others on the same codebase: inconsistent code style. When doing code reviews I just want to point out there should be a space between the if and the parentheses, or between the parentheses after the function name and the opening brace, and so forth.

I think that coding styles should match, but we all know that isn't going to happen. I agree with placing a space between the if and parentheses, but not following a function name. I always place opening/closing braces on their own lines kinda like so:

function whatever(params)
{
}

I find it easier to read. I also like adding "proper" indentation for my code as well. I tab for each nested item and command/statement, kinda like so:

function whatever(params)
{
     if (params == 'whatever')
     {
          for($i = 0; $i < count(params); $i++
          {
                statement;
          }
     }
     statement;
}

I don't know. I just find it more readable.


BBS Signature
FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 19th, 2012 @ 12:40 PM Reply

Yes, I forgot the closing parenthesis for my last bit of code.


BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Developers Ranting Thread Dec. 19th, 2012 @ 01:52 PM Reply

At 12/19/12 09:19 AM, Mich wrote: When doing code reviews I just want to point out there should be a space between the if and the parentheses, or between the parentheses after the function name and the opening brace, and so forth.

There is no "correct way" to style the code that you write[1]. Personally that is how I style my code as well, but if I were to join a project where all existing code is not written that way I wouldn't suggest that they change everything and conform to my preference. I would write my code in the style that is currently existent in the project.

As FallingTears said: the style should be consistent, and sometimes that means writing in a style that is not your preference. However if that is the coding style of the projects you are doing reviews for then by all means correct those mistakes by pointing them out to the developers that made said mistakes.

[1] There are exceptions to that of course. An example being JavaScript where placing an opening curly brace on the next line following a statement is generally considered a bad idea due to how JavaScript is parsed.

At 12/19/12 12:38 PM, FallingTears wrote: I find it easier to read. I also like adding "proper" indentation for my code as well. I tab for each nested item and command/statement, kinda like so:

Allman style is pretty sweet. :)
I find myself, when writing in a C-like, either using that or K&R style.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 19th, 2012 @ 02:01 PM Reply

At 12/19/12 01:52 PM, Diki wrote: [1] There are exceptions to that of course. An example being JavaScript where placing an opening curly brace on the next line following a statement is generally considered a bad idea due to how JavaScript is parsed.

This may be so, but I haven't had trouble out of JavaScript parsers when I've placed my opening curly brace on the following line.


BBS Signature
dem0lecule
dem0lecule
  • Member since: Feb. 17, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Developers Ranting Thread Dec. 19th, 2012 @ 03:43 PM Reply

Styling code in C-like languages is quite important for me, just save my time to hunt for missing brackets. Often I don't have this habit for non-bracket language like Python unless the project belongs to some big development.

At 12/18/12 09:57 AM, FallingTears wrote: Rant 1:

Customers. I have a love/hate relationship with customers. Could someone explain to me why customers, after a deadline is set, wait until the last second to get you all the content that you need to complete their website? You spend all night the day before a site is supposed to go live making sure you put all the content in place, making sure everything is styled properly, making sure all the links work, etc. While the customer is at home enjoying their children, you're having an all nighter because they couldn't get the information you needed earlier in the development process. Customer's, I would like you to have a special "You are a f****** moron" episode. Gosh, I hate you guys ... but you're necessary for me to make my cash!

I know right. 7 out of 10 of the customers like to assume the programmer(s) is/are whiz. They just like to believe changing contents and data is like a snap of finger. I have this serious problem since I use custom CMSs (I work for a Canadian wed design company), and these CMSs are crappy when come to speed.

Worst thing is they decide to do some major change at the last hour. Like adding contents that existing CMS can't do without major update. After some unfortunate fights with customers (and with my manager), now I state clearly to my customers that they shouldn't make major changing decision when near the deadline.

Rant 2:

Facebook, why did you add a security measure to your "Recommend/Like" buttons? If too many "suspicious" requests are sent to FB, the Recommend button becomes a "Confirm Link." FB, you really piss me off!!!!!!!! This isn't suspicious activity, but the work of developers in progress making sure things are in place for their clients. Did you fall off planet retard? Oh my gosh, I could so kick social networking in its metaphoric crotch! GRRRRR!!!!!!

I think these security measurements counter fake like from auto bot and spammer. After this. Right now on black market you can get 20k likes for less than 10 bucks. But no doubt hackers can bypass them easily.

My rant...

Drupal sucks... co-worker sucks...

:( One of my clients' website just have a breach. Checking log that they extracted both admin and user data. Look like SQL injection, all our MySQL databases were compromised (a lot of attempt to try to drop the DB). Problem is I checked all the MySQL statements and there is no error. Looked deeper into logs and found the rascal(s) exploited via Drupal webmail. Turned out my co-worker didn't patch Drupal. At least he configured the IDS in right way.


What comes around goes around...

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Developers Ranting Thread Dec. 19th, 2012 @ 04:33 PM Reply

At 12/19/12 02:01 PM, FallingTears wrote: This may be so, but I haven't had trouble out of JavaScript parsers when I've placed my opening curly brace on the following line.

It's one of those "better safe than sorry" situations. It will only occur when the parser inserts a semi-colon where it shouldn't have (since if you omit the semi-colon it will attempt to fix that error for you).
Here's a bit of a contrived example where it will happen:

function doSomething()
{
    return
    {
        hello: "world"
    };
}

That function will return undefined.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 20th, 2012 @ 08:23 AM Reply

At 12/19/12 04:33 PM, Diki wrote: function doSomething()
{
return
{
hello: "world"
};
}

That function will return undefined.

I tried this and you were exactly right. This is probably one of the most interesting things that I've learned year to date about JavaScript. Wow. I wonder what other little nuances can be exploited with JavaScript parsers. I've used JS quite extensively, but I've never really thought about how the parser works beyond the general syntax of the language.


BBS Signature
deckheadtottie
deckheadtottie
  • Member since: Oct. 21, 2003
  • Offline.
Forum Stats
Supporter
Level 58
Programmer
Response to Developers Ranting Thread Dec. 20th, 2012 @ 04:04 PM Reply

IDEs that don't have line-numbering on by default. I'm not missing something here, am I? That is mental, right?


#coys

BBS Signature
Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 20th, 2012 @ 05:53 PM Reply

At 12/19/12 01:52 PM, Diki wrote: There is no "correct way" to style the code that you write[1].

I wholly agree. He wasn't even being consistent though. If you add to a file that has an established code style, stick to it.
I tend to go with the style JSLint recommends. (Read: enforces).

At 12/20/12 08:23 AM, FallingTears wrote:
At 12/19/12 04:33 PM, Diki wrote: return
{
hello: "world"
};
I tried this and you were exactly right. This is probably one of the most interesting things that I've learned year to date about JavaScript. Wow. I wonder what other little nuances can be exploited with JavaScript parsers. I've used JS quite extensively, but I've never really thought about how the parser works beyond the general syntax of the language.

This thing happens thanks to automatic semicolon insertion. It's also the reason why I go for braces on the same line in JS. In other languages I usually just go for your style too.

There are douchebags who exploit automatic semicolon insertion so they can leave out semicolons. There's no good reason to do this as that is just relying on JS implementations rather than writing proper readable code. It's a stupid thing to do to show off you know how JS is parsed, in lieu of writing readable code. You can enjoy this ridiculous JS drama that occured on twitter bootstrap's github, where on of the devs was being exactly that kind of douchebag.

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Developers Ranting Thread Dec. 20th, 2012 @ 06:58 PM Reply

At 12/20/12 05:53 PM, Mich wrote: this ridiculous JS drama

http://www.youtube.com/watch?v=5F9Qpe7m5j8


BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Developers Ranting Thread Dec. 21st, 2012 @ 09:28 AM Reply

At 12/20/12 05:53 PM, Mich wrote: I tend to go with the style JSLint recommends. (Read: enforces).

JSLint is definitely better than nothing, though personally I find it to be a tad redundant. Plus it's hard to take something seriously that has goatse as its logo.

At 12/20/12 05:53 PM, Mich wrote: This thing happens thanks to automatic semicolon insertion. It's also the reason why I go for braces on the same line in JS. In other languages I usually just go for your style too.

You know what's really sad? GitHub recommends not writing semi-colons because of that stupid "feature":

Do your best to never use a semicolon. This means avoiding them at line breaks and avoiding multi-statement lines.

Source

As much as I love GitHub that is incredibly stupid.

At 12/20/12 05:53 PM, Mich wrote: There are douchebags who exploit automatic semicolon insertion so they can leave out semicolons. There's no good reason to do this

I completely agree. Not writing semi-colons works most of the time, but in some cases it doesn't work, so in those cases you need to write the semi-colon... so why not just write the semi-colon all the time? I cannot fathom why someone would do otherwise. I guess it's like you said: people want to show off that they have superfluous knowledge of how JavaScript is parsed; it's like a pissing contest.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 21st, 2012 @ 02:34 PM Reply

At 12/21/12 09:28 AM, Diki wrote:
At 12/20/12 05:53 PM, Mich wrote: I tend to go with the style JSLint recommends. (Read: enforces).
JSLint is definitely better than nothing, though personally I find it to be a tad redundant. Plus it's hard to take something seriously that has goatse as its logo.

I decided that I would, for giggles, take an old JavaScript file, that I wrote in JSON to demonstrate the differences between my web host's server time and the time on the user's computer, and run it through the JSLint parser. My JavaScript file had tons of errors. After thirty minutes of corrections, I finally got the file "JSLint" verified. Apparently, my JS is terribly constructed.

I think I added extra items to the JavaScript that I probably didn't need. Also, I think I have some "logic" errors that need to be fixed. Anyways, here's a look at the file after JSLint

<script>
// File name: date.js
// Version: 2.10
// Notes: The first version was around 90 lines of code. The first version was sloppier and much less efficient than this version.
// This edition does have more lines, but overall has a better structure and organization.
//
// Author name: Samuel Stidham
// Date: 09/29/2010
// Purpose: To display a date and time string. To reduce the size of the index.php file.

var displayDate =
{
a : Array, // Month names array
b : Array, // Day names array
c : Date, // Current date
currMonth : null, // Holds the numeric value for the current month
dayMonth : null, // Holds the numeric value for the current day of the current month
dayName : null, // Holds the name for the day of the week, such as Sunday
daySuffix : null, // Holds the proper day suffix, etc ("st","nd","rd","th)
year : null, // Holds the year information, such as 1994
hours : null, // Holds the hours information
mins : null, // Holds the Minutes information
secs : null, // Holds the seconds information
merid : null, // Holds meridien information
timezone : null, // Holds the timezone information
init : function () {
"use strict";
/*jslint browser:true */
var datestring, timestring;
// Initialize the month names array
this.a = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
// Initialize the day names array
this.b = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
// Initialize and get the current date
this.c = new Date();

// COLLECT DATE INFORMATION

// Get the numeric value for the current month
this.currMonth = this.c.getMonth();
// Get the numeric value for the current day
this.dayMonth = this.c.getDate();
// Correct the numeric value for days, if the days numeric value is less than 10
this.dayMonth = this.correctDays(this.dayMonth);
// Get the name of the day of the week using the numeric value for the day of the week
this.dayName = this.b[this.c.getDay()];
// Select the proper suffix for the day in the month
this.daySuffix = this.setSuffix(this.dayMonth);
// Get the current year
this.year = this.c.getFullYear();

// COLLECT TIME INFORMATION

// Get the hours value
this.hours = this.c.getHours();
// Selecting the proper meridien
this.merid = this.hours >= 12 ? "PM" : "AM";
// Convert the hours to the 12-hour format
this.hours = this.correctHours(this.hours);
// Get the minutes value
this.mins = this.c.getMinutes();
// Get the seconds value
this.secs = this.c.getSeconds();
// Append a 0 in front of minutes less than 10
this.mins = this.correctMinutes(this.mins);
// Append a 0 in front of seconds less than 10
this.secs = this.correctSeconds(this.secs);
// Get the correct GMT/UTC Timezone
this.timezone = -(this.c.getTimezoneOffset() / 60);
// Format the timezone value to match a timestamp
this.timezone = this.timezone + ":00";

// OUTPUT DATE AND TIME INFORMATION

// Create the date string
datestring = "Date: " + this.dayName + " " + this.a[this.currMonth] + " " + this.dayMonth + this.daySuffix + ", " + this.year + "<br />";
// Create the time string
timestring = "Time: " + this.hours + ":" + this.mins + ":" + this.secs + " " + this.merid + "<br />" + " UTC " + this.timezone + "<br />";

// Display the date string
document.getElementById("element").innerHTML(datestring);
//Dispaly the time string
document.getElementById("element").innerHTML(timestring);
},
setSuffix : function (dayNumber) {
"use strict";
// Inilialize the local suffix variable and Use an index variable to contain info pertinent to the suffix
var suffix = null, index = null;

// Set the proper pre-suffix amount by figuring out which is the rightmost digit
if (dayNumber >= 10 && dayNumber < 20) {
index = dayNumber - 10;
} else if (dayNumber >= 20 && dayNumber < 30) {
index = dayNumber - 20;
} else if (dayNumber >= 30) {
index = dayNumber - 30;
} else {
index = dayNumber;
}

// Select the proper suffix based on the index amount
// If the number ends with one, then add a "st" as the suffix
if (index === 1) {
suffix = "st";
} else if (index === 2) { // If the number ends with two, then add a "nd" as the suffix
suffix = "nd";
} else if (index === 3) { // If the number ends with three, then add a "rd" as the suffix
suffix = "rd";
} else { // Otherwise, the suffix is "th"
suffix = "th";
}

// Return the value of the suffix variable
return suffix;
},
correctDays : function (days) {
"use strict";
// if the day number is less than 10, append a 0 in front of the day
if (days < 10) {
days = "0" + days;
}

// return the day value
return days;
},
correctHours : function (hours) { // Only display the hours in the 12-hour format
"use strict";
// If the hours are greater than 12 or less than 23, then subtract 12 hours from the time
if (hours > 12 && hours <= 23) {
hours = hours - 12;
}
// If the hours are less than 10 and greater than 0, then append a 0 on front of the hours
if (hours < 10 && hours > 0) {
hours = "0" + hours;
}
// If the hours are equal to 0, then the time is 12 AM
if (hours === 0) {
hours = 12;
}
// return the hours
return hours;
},
correctMinutes : function (mins) {


BBS Signature
FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 21st, 2012 @ 02:36 PM Reply

Sorry about the previous post. If someone wants to delete it, that's fine with me.

var displayDate =
        {
            a : Array,                      // Month names array
            b : Array,                      // Day names array
            c : Date,                       // Current date
            currMonth : null,               // Holds the numeric value for the current month
            dayMonth : null,                // Holds the numeric value for the current day of the current month
            dayName : null,                 // Holds the name for the day of the week, such as Sunday
            daySuffix : null,               // Holds the proper day suffix, etc ("st","nd","rd","th)
            year : null,                    // Holds the year information, such as 1994
            hours : null,                   // Holds the hours information
            mins : null,                    // Holds the Minutes information
            secs : null,                    // Holds the seconds information
            merid : null,                   // Holds meridien information
            timezone : null,                // Holds the timezone information
            init : function () {
                "use strict";
                /*jslint browser:true */
                var datestring, timestring;
                // Initialize the month names array
                this.a = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
                // Initialize the day names array
                this.b = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
                // Initialize and get the current date
                this.c = new Date();

                // COLLECT DATE INFORMATION

                // Get the numeric value for the current month
                this.currMonth = this.c.getMonth();
                // Get the numeric value for the current day
                this.dayMonth = this.c.getDate();
                // Correct the numeric value for days, if the days numeric value is less than 10
                this.dayMonth = this.correctDays(this.dayMonth);
                // Get the name of the day of the week using the numeric value for the day of the week
                this.dayName = this.b[this.c.getDay()];
                // Select the proper suffix for the day in the month
                this.daySuffix = this.setSuffix(this.dayMonth);
                // Get the current year
                this.year = this.c.getFullYear();

                // COLLECT TIME INFORMATION

                // Get the hours value
                this.hours = this.c.getHours();
                // Selecting the proper meridien
                this.merid = this.hours >= 12 ? "PM" : "AM";
                // Convert the hours to the 12-hour format
                this.hours = this.correctHours(this.hours);
                // Get the minutes value
                this.mins = this.c.getMinutes();
                // Get the seconds value
                this.secs = this.c.getSeconds();
                // Append a 0 in front of minutes less than 10
                this.mins = this.correctMinutes(this.mins);
                // Append a 0 in front of seconds less than 10
                this.secs = this.correctSeconds(this.secs);
                // Get the correct GMT/UTC Timezone
                this.timezone = -(this.c.getTimezoneOffset() / 60);
                // Format the timezone value to match a timestamp
                this.timezone = this.timezone + ":00";

                // OUTPUT DATE AND TIME INFORMATION

                // Create the date string
                datestring = "<b>Date:</b> " + this.dayName + " " + this.a[this.currMonth] + " " + this.dayMonth + this.daySuffix + ", " + this.year + "<br />";
                // Create the time string
                timestring = "<b>Time:</b> " + this.hours  + ":" + this.mins + ":" + this.secs + " " + this.merid + "<br />" + " UTC " + this.timezone + "<br />";

                // Display the date string
                document.getElementById("element").innerHTML(datestring);
                //Dispaly the time string
                document.getElementById("element").innerHTML(timestring);
            },
            setSuffix : function (dayNumber) {
                "use strict";
                // Inilialize the local suffix variable and Use an index variable to contain info pertinent to the suffix
                var suffix = null, index = null;

                // Set the proper pre-suffix amount by figuring out which is the rightmost digit
                if (dayNumber >= 10 && dayNumber < 20) {
                    index = dayNumber - 10;
                } else if (dayNumber >= 20 && dayNumber < 30) {
                    index = dayNumber - 20;
                } else if (dayNumber >= 30) {
                    index = dayNumber - 30;
                } else {
                    index = dayNumber;
                }

                // Select the proper suffix based on the index amount
                // If the number ends with one, then add a "st" as the suffix
                if (index === 1) {
                    suffix = "st";
                } else if (index === 2) {  // If the number ends with two, then add a "nd" as the suffix
                    suffix = "nd";
                } else if (index === 3) { // If the number ends with three, then add a "rd" as the suffix
                    suffix = "rd";
                } else { // Otherwise, the suffix is "th"
                    suffix = "th";
                }

                // Return the value of the suffix variable
                return suffix;
            },
            correctDays : function (days) {
                "use strict";
                // if the day number is less than 10, append a 0 in front of the day
                if (days < 10) {
                    days = "0" + days;
                }

                // return the day value
                return days;
            },
            correctHours : function (hours) { // Only display the hours in the 12-hour format
                "use strict";
                // If the hours are greater than 12 or less than 23, then subtract 12 hours from the time
                if (hours > 12 && hours <= 23) {
                    hours = hours - 12;
                }
                // If the hours are less than 10 and greater than 0, then append a 0 on front of the hours
                if (hours < 10 && hours > 0) {
                    hours = "0" + hours;
                }
                // If the hours are equal to 0, then the time is 12 AM
                if (hours === 0) {
                    hours = 12;
                }
                // return the hours
                return hours;
            },
            correctMinutes : function (mins) {
                "use strict";
                // Appends a 0 in front of minutes less than 10.
                if (mins < 10) {
                    mins = "0" + mins;
                }
                // return the minutes
                return mins;
            },
            correctSeconds : function (secs) {
                "use strict";
                if (secs < 10) {
                    secs = "0" + secs;
                }
                return secs;
            }
        };

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 08:41 AM Reply

You went way overboard with your comments there. These kind of comments aren't really necessary:

// Create the date string
// return the hours
// If the number ends with one, then add a "st" as the suffix

The code that they're commenting is very self-explanatory.
Here's your code with the comments removed that are, in my opinion, not necessary:

var displayDate = {
	a : Array,                      // Month names array
	b : Array,                      // Day names array
	c : Date,                       // Current date
	currMonth : null,               // Holds the numeric value for the current month
	dayMonth : null,                // Holds the numeric value for the current day of the current month
	dayName : null,            
	daySuffix : null,               // Holds the proper day suffix, etc ("st","nd","rd","th)
	year : null,                   
	hours : null,                
	mins : null,             
	secs : null,                    
	merid : null,           
	timezone : null,        
	init : function () {
		"use strict";
		/*jslint browser:true */
		var datestring, timestring;
		
		this.a = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
		this.b = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
		this.c = new Date();

		// COLLECT DATE INFORMATION

		this.currMonth = this.c.getMonth();
		this.dayMonth = this.c.getDate();
		// Correct the numeric value for days, if the days numeric value is less than 10
		this.dayMonth = this.correctDays(this.dayMonth);
		this.dayName = this.b[this.c.getDay()];
		this.daySuffix = this.setSuffix(this.dayMonth);
		this.year = this.c.getFullYear();

		// COLLECT TIME INFORMATION

		this.hours = this.c.getHours();
		this.merid = this.hours >= 12 ? "PM" : "AM";
		// Convert the hours to the 12-hour format
		this.hours = this.correctHours(this.hours);
		this.mins = this.c.getMinutes();
		this.secs = this.c.getSeconds();
		// Append a 0 in front of minutes less than 10
		this.mins = this.correctMinutes(this.mins);
		// Append a 0 in front of seconds less than 10
		this.secs = this.correctSeconds(this.secs);
		// Get the correct GMT/UTC Timezone
		this.timezone = -(this.c.getTimezoneOffset() / 60);
		// Format the timezone value to match a timestamp
		this.timezone = this.timezone + ":00";

		// OUTPUT DATE AND TIME INFORMATION

		datestring = "<b>Date:</b> " + this.dayName + " " + this.a[this.currMonth] + " " + this.dayMonth + this.daySuffix + ", " + this.year + "<br />";
		timestring = "<b>Time:</b> " + this.hours  + ":" + this.mins + ":" + this.secs + " " + this.merid + "<br />" + " UTC " + this.timezone + "<br />";

		document.getElementById("element").innerHTML(datestring);
		document.getElementById("element").innerHTML(timestring);
	},
	setSuffix : function (dayNumber) {
		"use strict";
		var suffix = null, index = null;

		// Set the proper pre-suffix amount by figuring out which is the rightmost digit
		if (dayNumber >= 10 && dayNumber < 20) {
			index = dayNumber - 10;
		} else if (dayNumber >= 20 && dayNumber < 30) {
			index = dayNumber - 20;
		} else if (dayNumber >= 30) {
			index = dayNumber - 30;
		} else {
			index = dayNumber;
		}

		if (index === 1) {
			suffix = "st";
		} else if (index === 2) {
			suffix = "nd";
		} else if (index === 3) {
			suffix = "rd";
		} else {
			suffix = "th";
		}

		return suffix;
	},
	correctDays : function (days) {
		"use strict";
		
		if (days < 10) {
			days = "0" + days;
		}

		return days;
	},
	correctHours : function (hours) { // Only display the hours in the 12-hour format
		"use strict";
		if (hours > 12 && hours <= 23) {
			hours = hours - 12;
		}
		
		if (hours < 10 && hours > 0) {
			hours = "0" + hours;
		}
		
		if (hours === 0) {
			hours = 12;
		}
		
		return hours;
	},
	correctMinutes : function (mins) {
		"use strict";
		
		if (mins < 10) {
			mins = "0" + mins;
		}
		
		return mins;
	},
	correctSeconds : function (secs) {
		"use strict";
		if (secs < 10) {
			secs = "0" + secs;
		}
		return secs;
	}
};

Some of the other comments could also be removed with more descriptive variable and function names, such as renaming the a/b/c variables to monthsArray/daysArray/currentDate, and renaming correctHours to to12HourFormat.
Commenting is a great thing, but a good rule of thumb is to only comment code when it's not immediately obvious what it is doing or representing.

Just some friendly advice; take it or leave it. :)

Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 12:38 PM Reply

At 12/21/12 02:36 PM, FallingTears wrote: Sorry about the previous post. If someone wants to delete it, that's fine with me.

I've also got a little suggestion regarding your use of "use strict":

If you put all your code of one file in a self-invoked function:

(function () {
    "use strict";
    // ... code goes here ...
}());

... You only need to add the "use strict" once, as it applies for the whole body of that function. Using that self-invoking function also helps prevent polluting the global namespace.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 01:41 PM Reply

I removed all the comments, renamed some variables, used shorthand ifs where appropriate, and minified the JS. That being said, it runs a lot faster in the browser now. Also, thanks for the tips, I'll keep that in mind. I wrote that in 2010 for a homework assignment.


BBS Signature
FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 02:15 PM Reply

Get the following errors from the JSLint parser, if you guys could so kindly help me resolve them (I haven't used JSLint before yesterday):

Do not wrap function literals in parens unless they are to be immediately invoked.

(function () {

line 1 character 2
Expected an assignment or function call and instead saw an expression.

(function () {

unused
displayDate
'anonymous' 1

(function () {
    "use strict";
    var displayDate = {
        monthArray : Array,
        dayArray : Array,
        currentDate : Date,
        currMonth : null,
        dayMonth : null,
        dayName : null,
        daySuffix : null,
        year : null,
        hours : null,
        mins : null,
        secs : null,
        merid : null,
        timezone : null,
        init : function () {
            /*jslint browser:true */
            var datestring, timestring;
            this.monthArray = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
            this.dayArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
            this.currentDate = new Date();

            this.currMonth = this.currentDate.getMonth();
            this.dayMonth = this.currentDate.getDate();
            this.dayMonth = this.correctDays(this.dayMonth);
            this.dayName = this.dayArray[this.currentDate.getDay()];
            this.daySuffix = this.setSuffix(this.dayMonth);
            this.year = this.currentDate.getFullYear();

            this.hours = this.currentDate.getHours();
            this.merid = this.hours >= 12 ? "PM" : "AM";
            this.hours = this.correctHours(this.hours);
            this.mins = this.currentDate.getMinutes();
            this.secs = this.currentDate.getSeconds();
            this.mins = this.correctMinutes(this.mins);
            this.secs = this.correctSeconds(this.secs);
            this.timezone = -(this.currentDate.getTimezoneOffset() / 60);
            this.timezone = this.timezone + ":00";

            datestring = "<b>Date:</b> " + this.dayName + " " + this.monthArray[this.currMonth] + " " + this.dayMonth + this.daySuffix + ", " + this.year + "<br />";
            timestring = "<b>Time:</b> " + this.hours  + ":" + this.mins + ":" + this.secs + " " + this.merid + "<br />" + " UTC " + this.timezone + "<br />";

            document.getElementById("element").innerHTML(datestring);
            document.getElementById("element").innerHTML(timestring);
        },
        setSuffix : function (dayNumber) {
            var suffix, index;
            index = (dayNumber > 10 && dayNumber < 20 ? dayNumber - 10 : (dayNumber > 20 && dayNumber < 30 ? dayNumber - 20 : (dayNumber > 30 ? dayNumber - 30 : dayNumber)));
            suffix = (index === 1 ? "st" : (index === 2 ? "nd" : (index === 3 ? "rd" : "th")));
            return suffix;
        },
        correctDays : function (days) {
            if (days < 10) {
                days = "0" + days;
            }
            return days;
        },
        correctHours : function (hours) {
            if (hours > 12 && hours <= 23) {
                hours = hours - 12;
            } else if (hours < 10 && hours > 0) {
                hours = "0" + hours;
            } else if (hours === 0) {
                hours = 12;
            }
            return hours;
        },
        correctMinutes : function (mins) {
            if (mins < 10) {
                mins = "0" + mins;
            }
            return mins;
        },
        correctSeconds : function (secs) {
            if (secs < 10) {
                secs = "0" + secs;
            }
            return secs;
        }
    };
});

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 02:22 PM Reply

It's saying that because you didn't call the function at the end.
You'll want to replace this last line:

});

With this:

}());
FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 02:28 PM Reply

I have cut the code down even further. One error has been corrected, but I still get the following two errors. I don't know what to do to make sure those errors no longer show up:

Do not wrap function literals in parens unless they are to be immediately invoked.

(function () {

line 1 character 2
Expected an assignment or function call and instead saw an expression.

(function () {

(function () {
    "use strict";
    var displayDate = {
        monthArray : Array,
        dayArray : Array,
        currentDate : Date,
        currMonth : null,
        dayMonth : null,
        dayName : null,
        daySuffix : null,
        year : null,
        hours : null,
        mins : null,
        secs : null,
        merid : null,
        timezone : null,
        init : function () {
            /*jslint browser:true */
            var datestring, timestring;
            this.monthArray = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
            this.dayArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
            this.currentDate = new Date();

            this.currMonth = this.currentDate.getMonth();
            this.dayMonth = this.currentDate.getDate();
            this.dayMonth = this.correctDaysAndTimes(this.dayMonth);
            this.dayName = this.dayArray[this.currentDate.getDay()];
            this.daySuffix = this.setSuffix(this.dayMonth);
            this.year = this.currentDate.getFullYear();

            this.hours = this.currentDate.getHours();
            this.merid = this.hours >= 12 ? "PM" : "AM";
            this.hours = this.TwelveHourFormat(this.hours);
            this.mins = this.currentDate.getMinutes();
            this.secs = this.currentDate.getSeconds();
            this.mins = this.correctDaysAndTimes(this.mins);
            this.secs = this.correctDaysAndTimes(this.secs);
            this.timezone = -(this.currentDate.getTimezoneOffset() / 60);
            this.timezone = this.timezone + ":00";

            datestring = "<b>Date:</b> " + this.dayName + " " + this.monthArray[this.currMonth] + " " + this.dayMonth + this.daySuffix + ", " + this.year + "<br />";
            timestring = "<b>Time:</b> " + this.hours  + ":" + this.mins + ":" + this.secs + " " + this.merid + "<br />" + " UTC " + this.timezone + "<br />";

            document.getElementById("element").innerHTML(datestring);
            document.getElementById("element").innerHTML(timestring);
        },
        setSuffix : function (dayNumber) {
            var suffix, index;
            index = (dayNumber > 10 && dayNumber < 20 ? dayNumber - 10 : (dayNumber > 20 && dayNumber < 30 ? dayNumber - 20 : (dayNumber > 30 ? dayNumber - 30 : dayNumber)));
            suffix = (index === 1 ? "st" : (index === 2 ? "nd" : (index === 3 ? "rd" : "th")));
            return suffix;
        },
        correctDaysAndTimes : function (denom) {
            denom = (denom < 10 ? "0" + denom : denom);
            return denom;
        },
        TwelveHourFormat : function (hours) {
            hours = (hours > 12 && hours <= 23 ? hours - 12 : (hours < 10 && hours > 0 ? "0" + hours : 12));
            return hours;
        }
    };

    displayDate.init();
});

BBS Signature
Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 07:30 PM Reply

To get back to developer ranting:

Wordpress is absolutely awful. My personal site runs on it because I was a dumbass, and now I'm just too lazy to migrate to a new system. I started redesigning my blog, and now I'm implementing it with wordpress, but I can't get over just how awful everything about it is. They're polluting the global namespace with loads and loads of functions, many of which echo things on their own (as opposed to just returning a string which you can then echo on your own).

And here's the kicker: in the footer of the wordpress.org website it reads: "Code is poetry". I'm not sure if that's just a joke at their own expense, or if someone deserves an asskicking.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 22nd, 2012 @ 07:46 PM Reply

At 12/22/12 02:22 PM, Diki wrote: Everything you said

Once again your wisdom and mastery remains standing. Thank you for your help. Apparently, I write sloppy garbage like JavaScript. That is definitely going to change!!! In other news, I think I'm going to refer to you as Sensei Diki from now on ...

At 12/22/12 07:30 PM, Mich wrote: And here's the kicker: in the footer of the wordpress.org website it reads: "Code is poetry". I'm not sure if that's just a joke at their own expense, or if someone deserves an asskicking.

I vote for the "asskicking," but that's just me.


BBS Signature
Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 23rd, 2012 @ 07:51 AM Reply

At 12/22/12 07:46 PM, FallingTears wrote: Apparently, I write sloppy garbage like JavaScript. That is definitely going to change!!!

I'd recommend giving JavaScript patterns by Stoyan Stefanov a read. Definitely some good stuff there. Don't just read it though, try out a bunch of the patterns on little side projects.

Another worthy read would be the classic JavaScript: the Good Parts by the man himself, Douglas Crockford.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Dec. 28th, 2012 @ 08:43 PM Reply

Back to ranting:

GRAPHICS DESIGNERS!!!!!!!!

Need I say more? I think not.


BBS Signature
Mich
Mich
  • Member since: Jan. 12, 2008
  • Offline.
Forum Stats
Member
Level 42
Musician
Response to Developers Ranting Thread Dec. 29th, 2012 @ 06:15 AM Reply

At 12/28/12 08:43 PM, FallingTears wrote: Back to ranting:

GRAPHICS DESIGNERS!!!!!!!!

Need I say more? I think not.

They're not all bad in my opinion. You've got to make sure they read this though: http://photoshopetiquette.com/

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Jan. 7th, 2013 @ 02:57 PM Reply

Back end php developers drive me crazy too. Especially when they try to mix PDO with mysql functions. Then, I get to play the crazy game of "fix the back end syntax errors and work on the front end stuff." Wonderful. I might as well do both the back end and front end. (In my honest opinion, sometimes that's the only way things will be done right.)


BBS Signature
zenyara
zenyara
  • Member since: Jun. 17, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to Developers Ranting Thread Jan. 9th, 2013 @ 01:14 AM Reply

Pretty much every subject mentioned here: Graphics people, sloppy coders, CMS, Internet Explorer, douchey customers.

I was stuck in a department with 2 graphics guys who did nothing but joke and talk all day while I tried to concentrate on coding. I wanted to throw, at least one of them, through the nearby window, head-first.

I will also mention working for a boss who has limited skills or knowledge of most web-design or coding subjects, but nonetheless will over-hype the dev department's abilities and timelines to make a quick sale.

My advice is to NEVER work for a web "company" unless you have direct control of it somehow (like a team) or it's really reputable.

And I hate working on "mom-and-pop" websites. They are the worst. They are the pickiest and always change their minds and waste your time and don't want to pay you what you're worth.

FallingTears
FallingTears
  • Member since: Nov. 28, 2012
  • Offline.
Forum Stats
Member
Level 03
Programmer
Response to Developers Ranting Thread Jan. 15th, 2013 @ 08:15 AM Reply

The keyboards we use at work. They're so dirty that I find myself washing my hands as many times feasible throughout the day to prevent myself from catching some kind of nasty disease/illness from them. Seriously, supply your new workers with new keyboards. Don't give them the old nasty things that have been here forever .... they're just gross.


BBS Signature