Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Quality Code vs Code

Hello,

I just created my first Wordpress theme, and I don't have too much experience with programming/markup yet. During the creation process of my theme, I feel like I spent a TON of time fiddling with margin/padding and all the other properties one could add to ids, classes, and divs to make them where you want them to be on the page.

My concern. I feel like my code is just crap code. Comparing it to a car. It looks great on the surface, but under the hood I'm sure an expert would see tons of wires tangled together and think, "why did he put so much padding there when he could have just..." yatta yatta.

My question. What is a good resource to see how "tangled my wires are under the hood" with my code? Are there any good code review groups on the web?

Thanks!

3 Answers

Andrew Shook
Andrew Shook
31,709 Points

If you are using this theme for personal use, then the question you need to ask yourself is "does it work"? If it looks exactly how you want it to, then it's probably good enough. I'm sure there are probably area's were you could tighten you code up, but that's normal. Programming is a lot like writing, after you've done you first draft, you go back and make change so that the end result is better. If you want to know about ways to make you css more D.R.Y, then check out OOCSS and SMACSS. These are just ways to organize your css so that it is lightweight and easy to maintain.

As far as programs or groups that will review your code to see how optimized your code is, there are some website that will do it for you (just google css optimization). However, you should know that they can have unexpected results sometimes. If you would like someone to do a peer review of you code just post a link to your website and I'm sure myself or someone else could take a quick look at it.

p.s I'm a Drupal developer, and while I might not be a lot of help with WP specific stuff, I can help with optimizing your css. Feel free to email me at shookandrew@yahoo.com

Thanks for the resources. Sent an email your way.

Tyler, I'll be happy to review your WP code if you'd like. You can zip up the whole theme and email it to me at homosaur@gmail.com or just hit me up on Twitter @paulgraham if you want to do a Dropbox share or something. I have years of WP experience and have developed many successful themes and screwed up many times that so I can help you out with some of these issues.

There's a great video on Treehouse that covers some of the stuff Andrew is talking about re CSS. CSS seems simple but it's actually quite difficult to manage a complex site and requires experience. The fault may be with your CSS or it may be with your HTML structure.

I totally agree on CSS being "quite difficult." Thanks for the link to video. I'm still working on getting through all the CSS videos. I sent an email your way.

I understand how you are feeling Tyler. There is like 65 CSS videos (more than Ruby videos) and just wait until they add the Saas and Compass videos. It's useful for me to look at shipped code to see learn best practices. Be it looking at a woo themes wp theme, thisisresponsive.com, admiring the organized Saas of zurb.foundation.com. Poke around popular github repos or just chrome web inspect cool sites.

Its not going to make you feel less crappy about your code (only experience writing will do that) but It might help. It's a good habit anyway.

At least these days we have tools like Treehouse, Sublime Text, Sass, Git, StackExchange, Chrome Dev Tools etc. to make developing easier than it was before.

Keep coding, watching and applying and one day your confidence will click in place.

Thanks for the advice. Looking at other people's code is something I've not done too much. Definitely need to start doing that more.