iMarc | Interactive Media Architects
  • Portfolio
  • Process
  • About
  • Communiqué
  • Contact
  • Support
  • Search

Lunchroom Banter (Volume XIV)

by Dave Tufts - June 27, 2007 / 1:58pm View more articles

The Banter Through Code Edition...

Jeff just sent a link to a recent WorthThanFailure article with a horrible coding example. In the article, a recent grad submits the following example during an interview:

public int factorial(int n) { int a = 0; for (int i = 1; i < 10; i++) { i = i * (i + 1); a = i; } return a; }

The author of that lovely block of code thought he was solving a factorial problem, but all his function does is return the number 12. A bunch of the iMarc develops suggested alternatives.

Dave

public int get_twelve() { return 12; }

Patrick

get_12(int $twel) { if ($twel == 12) { // DONT DO ANYTHING HERE } else { $twel = 12; } return ((($twel - 6) * 4) / 2); }

Fred

// Pff, with the Azule framework, we can go ahead // and make that twelve an object. $twelve = TwelveFactory::create(); // And from there we can add or subtract. $thirteen = $twelve->add(1); // There is also simple data retrieval. $x = 1 + $twelve->getValue();

Craig Ruksznis

Hey just because I'm a recent college grad doesn't mean that I don't know how to make a function return 12!

New guys... all talk, no examples. :)

More Articles Get the RSS Feed Post A Comment

7 Comments

by Craig Ruksznis   #
on June 27, 2007 / 3:48pm
echo 'not worth taking the time to rebut';
by Robert Mohns   #
on June 27, 2007 / 4:14pm
I suggest that we rename "exception" to "ruksznis"
by Patrick McPhail   #
on June 27, 2007 / 4:21pm
throw new Ruksznis('ERROR: F--');
by Craig Ruksznis   #
on June 28, 2007 / 9:30am
How can I have an F minus MINUS? A new low, I suppose...
by Patrick McPhail   #
on June 28, 2007 / 9:44am
it's all in the comments in the Ruksznis class.
by corti   #
on September 6, 2007 / 5:20pm
wow. you guys take geekiness to a whole new level. im in awe.
by Patrick McPhail   #
on September 6, 2007 / 5:42pm
if ($cortis_comment == 'inappropriate') {
throw new Ruckshuneece('F--');
}

Comments have been turned off on this blog.
Read something more recent.

Statements and opinions expressed in this blog and any comments made are the private opinions of the respective poster, and, as such, iMarc LLC is neither responsible nor liable for such content.

iMarc

iMarc is a web development company in Newburyport, MA. This is our blog.
View all blogs or learn more about iMarc.

About the Author

Dave's Head Dave Tufts, Vice President of Technology
I help people build websites.
I have two daughters.
I'd rather be gardening.
More blogs by Dave

Search Our Blog

Recent Communiqués

  • Lunchroom Banter (Volume XVIII)
  • Building a Museum Website
  • iMarc is 11 years old today
  • Pre-holiday hijinks
  • Look and Feel
  • Gardening and Web Writing
  • Trusting Experts, Part 1
  • USC Trojans vs Oregon State Beavers
  • On My Days Off
  • Make your site 52.676% more cool
  • iMarc Grows (again)
  • Laying the subfloor
  • Inc. 5000
  • Say Hello to our new Sys Admin
  • "Not Invented Here" for a Triple Word Score

Popular Communiqués

  • Building a Museum Website
  • iMarc Grows (again)
  • iMarc is 11 years old today
  • Pre-holiday hijinks
  • Laying the subfloor
  • Lunchroom Banter (Volume XVIII)
  • Trusting Experts, Part 1
  • Look and Feel
  • Make your site 52.676% more cool
  • Inc. 5000

Recent Comments

  • Lunchroom Banter (Volume XVIII)

    By Patrick McPhail: What you'll notice is that in both scenarios I suffer.

  • iMarc is 11 years old today

    By soso: happy life day

  • iMarc is 11 years old today

    By Nick: When a company has a birthday, does that mean the CEO's had sex? …

  • iMarc is 11 years old today

    By Marino: Happy Birthday!

  • iMarc is 11 years old today

    By Josh Cole: Happy Birthday! Can't you use both your fingers and toes to count?

RSS

RSS Icon Learn about RSS and get the feed for our blog.

About iMarc

  • We build custom web sites
  • In-house strategy, design, programming, hosting
  • In business since 1997
  • We’re located in Newburyport, MA
  • Call us at (978) 462-8848

© 2008 iMarc LLC, Contact Us

Links

  • Home
  • Portfolio
  • Client Support
  • Log In
  • (icon)RSS

Meet the Team

Christian's Head Christian Keyes, Designer

I am responsible for designing any graphic elements that clients may need. This includes but is not limited to creating Flash animations and script for interactive clips, layout design and coding, and working on iMarc's internal promotional pieces.

Learn More | Meet the Others