Why is coding so personal?

Benjam,on the topic of  JavaScript, PHP, Tools, Usability
02.25.2010   |   5comment

Why is coding so personal?
I’ve been noticing that often times, when getting or giving feedback on code, or browsing my favorite programming forum, or just reading posts about programming, that people often get very emotional about their code. I was wondering why this is, and because I am not a psychologist, I’ll just give you my thoughts.

Coding to me is like creating art, and there’s a great quote that backs me up on this:

Programming is an art form that fights back. —Unknown

Because code is like art, I get very attached to my code, as well as my style of coding. My code is like my baby, my something from nothing that wouldn’t be there if it weren’t for me. It’s just a bunch of characters on the screen that, from somewhere in the blue smoke, creates a function, or a game, or a website. I have received criticism on my code (as everyone has), as well as given criticism on other’s code (as everyone has), and those times when I’ve received criticism on my code, depending on how it was delivered, or what was said, it was almost like a personal attack on me. And I’ve noticed a few other coders react the same way to criticisms on their code. It’s like the person who called your code ugly or inelegant was saying that your child was ugly (and those of you who have kids know… that’s a huge no-no, punishable by any means available).

It may be because I think that my coding style is the best, it’s what I’m used to, and it’s the format I use because it’s the easiest for me to get at the information I need as fast as possible. I know this because I’ve tried other styles (sometimes flipping back and forth in the same day), and looking at someone else’s code that uses a different style from me, is often times hard to peruse easily. It’s what I like, and sometimes I have to hold myself back from reformatting code I come across into my own style.

So maybe we should stop thinking of code and coding styles as being “right” or “wrong”, and think of them more like the tool that they are, a means to an end. And the way you react to someone else’s means should be a little more like a suggestion for a different method of painting. Not a matter of fact, but just another tool for the tool box.

To continue the art analogy, it’s like everybody is given all the art supplies in the world, and told to make/paint/draw/create a box. Everyone will come up with a different way of doing it, some will be huge and bright red; others will be small and drawn in pencil; others still might be made of clay or brick. No matter what, it’s the way you chose to do it, and it’s no better or worse than the person’s next to you. You might think so because yours was faster, fancier, more elegant, or more “boxy”; but they might think the opposite. In the end, you still have a box, and so do they.


Sharpening the Blades: Tricking out WordPress, Designers who can’t code and Content Management

02.19.2010   |   0comment

This weeks edition features an article about customizing WordPress for beginners, designers who can’t code their own designs and the best way to handle content management systems for sites that matter.

Chad, The Beginner’s Guide to Tricking Out Your WordPress Blogtrickingoutwordpress
I liked this post/entry about WP because it was built and geared for the beginner. Once you installed it now what. I find these type of articles interesting because sometimes they are just so simple that I don’t even think of them. And it helps me to explain or think of other things that I feel our clients may want or need.

Mike, Web Designer’s Who Can’t Codedesignerswhocantcode
Twitter exploded in a debate this week when Elliot Jay Stocks boldly tweeted:

“Honestly, I’m shocked that in 2010 I’m still coming across ‘web designers’ who can’t code their own designs. No excuse.”

The world is full of talented designers trained in a wide array of media, but just like other mediums, the web offers its own constraints and limitations. Knowing how to code definitely gives you an edge, even if you don’t code the site yourself. Image resolution, measurements, typography, and browser discrepancies all play a role in what is possible, and help determine the collective best practices of the web. So does a good architect need to know how to dry wall? Maybe not. What about a fundamental understanding of construction and engineering? Absolutely. How much does a good web designer need to know about their craft in order to build a successful website? What do you think?

Mac, Content Management for Sites that Mattercontentmanagementforsitesthatmatter
I liked this article because it gets right at the core of the cost/benefit trade-off that many people don’t think enough about when building their web site. Either there’s a significant value to the work you’re doing on your site, which justifies spending some money on it and getting it done right, or there isn’t a significant value to your site, so why bother? I don’t 100% agree with them about the WYSIWIG comments, but I’ve never tried to tell a client to assume it would look identical in TinyMCE and on the public site. We’ve generally had to train them to be very careful to keep it simple. Use bold if you want, make some lists, paragraphs, links, and stuff like that, but don’t try and do anything funky or you’ll end up disappointed. Another annoying thing about TinyMCE is that even when you tweak the HTML manually in their HTML view, it often wants to “automatically fix” some of the things you did. I was trying to leave a <br /> or two between a couple of separate lists if I remember right, and it kept either taking it completely out, or turning into a paragraph, constantly leaving too much or too little whitespace, even though the HTML I manually entered would display exactly how I intended.


Sharpening the Blades: Custom WordPress Dashboard, Wireframing and Communication

02.05.2010   |   0comment

Tim, 10 WordPress Dashboard Hackscatswhocode
This is a nice article that shows you how to get a customized WordPress dashboard. The article calls them hacks, but I would call them customizations. One that I have tried and loved is adding your logo on the dashboard page next your blog title in the top left hand corner of the dashboard. It’s a nice little touch that goes a long way.

MikeHow Wireframing Makes Your Website Designs Betterbriancray
The value of wireframing comes down to a simple idea: Wireframing forces you to think about your user interface design decisions in terms of user needs first, instead of in terms of what looks good.” While wireframing requires a little extra effort in the initial planning stages, it pays huge returns in the long run. We redesign less frequently, hit deadlines sooner, and best of all, greatly mitigate scope creep. So take your foot off the pedal, assess your client’s business objectives and user needs, and translate concepts into a tangible wireframe. You’ll be glad you did.

LukeFor Better Productivity, Communicate Lesscommunicateless
I agree with Joel Spolsky in one of Lifehackers latest posts when he says that adding more people to a project will only slow it down. I think this is especially true in web development. Once deep into a big project a web developer knows where things are and how they are related. If you throw five of them at the same project at some point they would end up stepping on each others toes. There is a chance that if things are planned out right each developer could tackle a specific task and then they could put all their pieces together to make the final piece. To do that though a lot of planning and meeting together would have to happen. This will probably lead to more disagreements and toe stepping. For those reasons I think getting the few people needed on the project and keep them there is the best way to accomplish a web dev project.


Sharpening the Blades: Document Ready, Admins and Automagic in CakePHP

01.19.2010   |   0comment

This edition of Sharpening the Blades features articles about creating admin sections with CakePHP,  how $(document).ready( ) can slow down your site, and the wonderful things CakePHP can do “automagically.” Hopefully these articles will help you sharpen your coding blades.

Chad, Creating an Admin Section with CakePHPcakephp-admin
I have come across James blog just recently (about 2 months). The guys blog is great. He does so much with CakePHP that it is great to see what he is doing and what he can do. But the reason I suggest this specific post is because it seems to be the first stumbling block that every developer comes across while using CakePHP. This article specifically will explain how to get an Admin section set up and working. I consider this one of the must needed to know things to develop correctly in CakePHP.

Benjam, Don’t let Document Ready slow you downdocument-ready
Everybody wants to have a faster loading website, and I am certainly guilty of putting every DOM related jQuery snippet into the $(document).ready( ) function.  This post showed me that this wasn’t absolutely necessary and gives good examples of when and how to break out of the document ready mentality.

Mac, The Dark Side of CakePHP’s Automagicautomagic-cakephp
I’m not sure I like the title of this article so much as I like the article itself, but it does point out some useful information about the “automagic” things that CakePHP does for you. Some of the things they discuss are definitely features that were designed very wisely, even though the article seems to disagree with me on that. There are definitely some automagic things in Cake that they mention that drive me crazy too though, and I don’t really see the necessity for the seemingly poor decision made by Cake’s developers. My biggest peeve they mention are the behavior it has (or had, this may have been fixed/changed now) for many-to-many relationships (a.k.a. HABTM). It is really a pain in the neck when your relationship table has other data in it, like the date/time when the relationship was added, or by whom, or a quantity, etc.


Redirecting to parent or child pages in WordPress

Benjam,on the topic of  Usability, WordPress
01.12.2010   |   4comment

A few of our projects here at Code Greene required the use of WordPress, and those projects had situations that I have since encountered in a site I built in WordPress for someone in my family. That situation was trying to redirect to a parent or child page when a certain page was clicked on.

I know that may seem a bit confusing, but let me give an example. Say I have an “About” page, and that “About” page has three child pages; “Who I Am”, “What I Do”, and “Why I Do It”. Now let’s also say that my “About” page doesn’t have any actual content, it’s just a container for the other three pages, and I just want to redirect my visitors to the “About | Who I Am” page without ever hitting the “About” page. Well, here’s how I do that.

First we need a page template that we can use for the “About” page that will do all the magic for us:

In a new file in your theme folder called redirect_down.php (you can really call it anything you want, this is what I used), put the following:


<?php

/*
Template Name: Redirect Down
*/

// grab the direct children pages of this page
// (both child_of and parent are needed)
$sub_pages = get_pages(array('child_of' => $post->ID, 'parent' => $post->ID, 'sort_column' => 'menu_order', 'number' => 1));

$URI = get_permalink($sub_pages[0]->ID);

// redirect the user down one level in the tree
header('Location: '.$URI);

How this works is it finds the first child of the page you are on, grabs the URI for it, and redirects you to that page.

Now when I create my “About” page (the one with no content), I set my page template to “Redirect Down” in the template drop down, and voilà, when a visitor clicks on the “About” link, they automatically get redirected to the “About | Who I Am” page, no questions asked. If I had pages under the “Who I Am” page, and it was just a container for those, I could also set my template for the “Who I Am” page to “Redirect Down”, and when my visitor clicked the “About” link, it would redirect to the “Who I Am” page, which would then redirect to the first child page.

To complete the collection… in one of the projects I worked on recently, we had a situation where if a child page link was clicked, we needed to redirect up the tree to the parent page. This is basically the same thing, just the other direction, but also a bit easier to code. Here is how it is achieved:

In a new file in your theme folder called redirect_up.php (again, you can call it anything you want, this is just what I used), put the following:


<?php

/*
Template Name: Redirect Up
*/

// redirect the user up one level in the tree
$URI = rtrim($_SERVER['REQUEST_URI'], ' /');

$URI = substr($URI, 0, strrpos($URI, '/') + 1);

if ( ! in_array($URI, array('', '/'))) {
	header('Location: '.$URI);
}

The way this works, is it grabs the URI given, and simply removes the last directory from the URI. (You could also find the parent ID from the $post data and use that to find the permalink, much like the previous template, but this works for what I needed it to do.) If you have your permalinks set up properly, this should work beautifully. And again, with this one, you can set it on as many pages as you want, redirecting all the way up the tree if you wish.

Hope this helps someone. Let me know if it helped you in the comments below.


Whirly Bin

Luke,on the topic of  CakePHP, Web Development
10.29.2009   |   0comment

We recently launched a small ecommerce site for Whirly Bin. They sell all sorts of stationary. They needed a super simple shopping cart. Instead of hooking in our custom cart in CakePHP we hooked it up to PayPal. Whirly Bin can add new products and upload photos and descriptions for those products through a simple admin section we created with CakePHP. Whilry Bin was great to work with and we got the site designed, built, and up really quick. Check out their site.


Easton Baseball & Softball

Tim,on the topic of  News, Web Development, WordPress
09.29.2009   |   0comment

We partnered with Omelet to create the new site for Easton Baseball & Softball. Omelet did the design and we built the site. Easton wanted a WordPress site, so that is what we gave them. This theme is extremely custom but at the same time it is really easy to use when adding new products or pages.

Easton Baseball
eastonbaseball

Easton Softball
eastonsoftball1


Steel Encounters Inc.

Tim,on the topic of  News, Web Development, WordPress
09.25.2009   |   0comment

Steel Encounters came to us wanting to be able to manage their photo galleries in an easy way. Initially they were having an employee upload the images and then write code to insert them into galleries. We suggested they use WordPress with a custom theme to get their site to function they way they wanted and make it easy to do so. All the galleries on this site are managed through the default WordPress gallery function.

Visit Site

Screenshot of Steel Encounters


Outsourcing, Brain Surgery, and The 9’s

Mac,on the topic of  Business, PHP, Web Development
05.15.2009   |   1comment

This morning Mark and I attended a great talk by Eric Smith, CTO and Co-founder of Control4, at the UTC CTO P2P Forum, titled “Outsourcing: What not to do.”  The short version of the story is that a few years ago Control4 decided they should try outsourcing. They spent about $700,000 setting up a nice 50-man shop in Bangalore, with a good Indian HR manager and a guy from here that moved over there as a technical manager for the shop. In about a year and a half, they spent about $3,000,000 on the facility, and ran into a bunch of problems. They couldn’t hire and keep the top notch developers because they weren’t a big name company, and they had a lot of churn and turnover due to the 20-25% annual growth in average salaries. They had a hard time being clear enough and specific enough in their specs and task lists to get it built right the first time. The 12.5 hour time difference made things very hard for communication. On some projects, they had to go back and forth 17 times with changes, bugs, clarifications, etc. before it was done right.

When he talked about the results they got from this $3M, 1.5 year investment, he said that only about 30% of what the team produced was able to be salvaged and used. The other 70% had to be rebuilt from scratch. One of the most telling things he said was that by the time they got all the kinks worked out and the team there was working at full speed, the production they saw from the Bangalore office was about what they would have had if they had kept their technical manager here in the States and hired one more guy like him. Two top notch guys (for argument sake, say you’re paying them each $150K per year, a total of $300K/year plus their office space and any other administrative overhead) would have yielded the same output as a 50 person team costing $2M per year. He didn’t say, but if that doesn’t already factor in the “30% usable output” then the difference is even more drastic. Don’t forget that another cost besides the money is the time it takes to get to the right solution. If 1.5 years is what it would take to do it right, then 1.5 years to get it 30% right means you still have a lot of work to do and a lot more time (1-5 years) to really get it done, which in a competitive market can leave you in the dust.

One really sad thing is that this story is hardly unique. Many people we’ve talked to who have tried outsourcing projects (to India, Russia, or anywhere) have run into similar problems and worse. Most of the outsourced web development projects we hear about didn’t get in that deep of course, but the principle is the same.

So what is the moral of the outsourcing story? It really is the same lesson many others have learned: Cost, or hourly rate, isn’t the only thing that matters. Sure your outsourced developers are cheap, but what do you get for it? What’s the quality and quantity of their output?

Mark tells a great story about a guy who has a brain tumor. (more…)


“What does that do?” - Cake functions I’ve found

Benjam,on the topic of  CakePHP, PHP
05.07.2009   |   0comment

In this episode of “What does that do?” we’re going to look at a few helpers and methods of (probably) well known classes that may or may not be that well known, as well as enlighten you to a few gotchas that I’ve discovered during my Cake usage.

First is the Set::extract method. When I first started using Cake, I was using the dot notation in my extract and combine calls, that is until I discovered the XPath notation that was also allowed which offers more control over your returned values. One gotcha that I discovered early on, was that to emulate the dot notation {n}.Foo, you can’t just use /Foo, you have to add a /. to the end to make it work properly. So you end up with /Foo/.. One other thing I noticed while poking around in the source, was that the argument order for extract is opposite from that of combine. With combine, you put $data, then $path[12]. With extract, you put in $path first, then $data. I was doing it wrong for a long time, but the Cake developers thought of this, and silently flip them in extract if you get them backwards.

(more…)