Archive for the 'General' Category

Quick tip: Variable Naming Conventions

I am just in the middle of a huge code re-factoring. I am dealing with a huge amount of code which was previously made by someone else. Most of you probably know that working with someone else’s code is most of the time a pain in the ass. It gets even worse when it leaks in documentation.

So, for this really simple reason I decided to start writing quick-tips about coding which will hopefully help keeping your code clean and easy to understand. Here’s the first one.

Use reasonable and self-explanatory variable names

Think about how much time you often spend on figuring out what a variable is used for or what it is supposed to be. There are some bad examples:

# a lot of code before...
 
$b = SomeObject::getByID(12);
$na = "Cutting Edge";
$nu = 12;
$c = array('Audi', 'BMW', 'Mercedes', 'Aston Martin');
 
# a lot of code after...

Could you explain what those variables are meant to be? You will probably need to find the answer for that some other part of your code. A better way is to indicate the types and use self-explanatory variable names:

# a lot of code before...
 
$oBox = SomeObject::getByID(12);
$sName = "Cutting Edge";
$iNumber = 12;
$aCars = array('Audi', 'BMW', 'Mercedes', 'Aston Martin');
 
# a lot of code after...

In this example, the first characters indicate the data types of each variable (”o” means that the variable in subject is an object, “s” stands for strings, “i” indicates integers and so on. Pretty straight-forward.)

You may ask why this is a big deal. I tell you:

  • Easier to understand,
  • You know what to expect from a variable,
  • Others will understand the structure of your code a lot faster,
  • Also, it will be even easier for you too to maintain if you need to get back to your own code after a while.

So guys, please remember: Keep your code clean and sensible.

ECLM theme ported to XCode

A couple of months ago I’ve published our TextMate theme file which turned out to be really popular. Since that I’ve started experimenting with XCode but I could not get used to any of its default color themes.

XCode using the ECLM Color theme

XCode using the ECLM Color theme

I started to port our original TextMate theme to XCode. This is a quick screenshot of it, download will be available soon.

eclips3.media (ECLM) TextMate Theme

I usually check several development forums and I’ve found a thread on Rails Forum about development environments where people share a screenshot about their tools. I did this too, after several examples. Since my TextMate Theme got so many respects I decided to share it with the public.

One of its main benefits is that it separates the different data structures, functions, variables, comments, etc. So it is easier to look up your code.

Development Environment

So, if you like it, it can be found here.

Copyright: This theme was originally improved from the one what we can see in Ryan Bates’ Railscasts.

The people who make websites

In April 2007, A List Apart and An Event Apart conducted a survey of people who make websites. Close to 33,000 web professionals answered the survey’s 37 questions, providing the first data ever collected on the business of web design and development as practiced in the U.S. and worldwide. Now  the results just became public.

The findings they present here have never been seen before, because until now, no one has ever conducted public research to learn the facts of our profession.

Take a quick look at the website, read the article and check out the results which are available in different formats, such as Adobe PDF. (1.6 megabytes)

We are starting…

eclips3.media (ECLM) is a group of young guys who are interested in technological issues.

We have just started our tech blog which we want to use to collect and share all those useful informations which can help out everybody who is interested in these kind of developments.

The planned topics are…

  • Front-end web development
    (Mostly XHTML, CSS and Javascript topics with best practices)
  • Ruby on Rails
    (Ruby on Rails is an open-source web framework that is optimized for programmer happiness and sustainable productivity.)
  • Adobe Flash (formerly Macromedia Flash)
    (Strictly speaking, Adobe Flash Professional is an integrated development environment (IDE) while Flash Player is a virtual machine used to run, or parse, the Flash files.)
  • Hosting
    (All about hosting development, mostly FreeBSD based, with security issues, useful features, etc.)

We hope that these informations will be helpful for other people as well who are interested in these kind of topics just like us. Happy browsing!

More can be found on the about page.