>> Thursday, May 3, 2012
In this post I'll try to add some good practices which are nice to have in mind while developing for the web.
I'll talk about the most common technologies and the ones I know, of course.
HTMLIt's very important to follow standards, in every technology, but in web is really important, as your app is released to the masses and HTML is one of the things everyone can see. If you output bad HTML the browser might render it just fine, but it might break in some browsers, also, it's not good for a professional site to have malformed HTML, or deprecated HTML.
If you are starting a project from scratch you should consider using HTML 5, it's already supported, modernizr helps quite a bit for unsupported browsers, it's the new standard and it will look good on your portfolio.
HTML 5 isn't really hard to learn, it's simpler and nicely evolved from the old HTML, so you should really give it a try.
CSSCSS hasn't changed much, and support for CSS 3 isn't quite implemented correctly yet, so using CSS 2/2.1 is what you should do by now, but that doesn't mean you can't extend it!
LESS is there just for that, it takes CSS and adds a bit of logic inside, like variables, nested rules and more.
Once you understand this little language it's easy to love it.
Client Side FrameworksThere are several frameworks for this, basically what these frameworks do is give you a nice solid base so you can write cross-browser and even cross-platform (PC, Tablet, Mobile) applications with less effort.
These frameworks give you a base style and/or script for you to be as productive as possible.
My favourite right now is Bootstrap, a lightweight open source framework by Twitter. It gives you a nice CSS reset, fonts adjustments, and a grid system.
Using a framework like Bootstrap is highly recommended.
Server Side TechnologiesThis is sometimes personal taste, and sometimes more technical. The most common technology for web applications today is probably LAMP (Linux, Apache, MySQL and PHP), but there are other technologies which are getting quite popular too, like RoR, Django and ASP.NET MVC.
All of them are free to use, ASP.NET of course requires IIS 7 and a windows environment, but hiring a windows hosting isn't much more expensive than a linux one, nevertheless, if you plan on hosting your own app or are afraid it will scale a lot, licences might be a problem, Azure might be a workaround for this, as you don't pay licences at all, just the resources your site uses, but learning a whole new technology just you host your application there it's not really a big advantage.
Most of the time though, you can just choose whatever you feel like using, and its more fun to use for you, PHP, Django, RoR and ASP.NET MVC all handle themselves pretty nicely, performance won't be a real issue, you should worry about the speed of development and your own fun while developing.
Comparing PHP to RoR is quite unfair though, as RoR is a framework and PHP is a language, if anything, we could compare PHP to Ruby, but you won't ever want to use plain ruby for a web application, what you want is a framework, you can either make one yourself or use a well-tested one.
So for PHP I recommend using a MVC Framework, like CodeIgniter, CakePHP, Symfony or Yii.
What PHP really lacks is some kind of advanced functionality, of course, PHP does have that, but for example, if you want advanced caching, you might need to install APC, or XCache, or memcache, on ASP.NET MVC you just use the standard cache you are given with the framework, this makes PHP a bit harder to use, but more versatile.
Note: StackOverflow uses redis for it's cache.
It's important to note though, most of the time you won't really need to worry much about the server-side technology, that beeing what database engine you use, how you cache, what language or framework you use, what you do have to have in mind is the client side, that's why using something like Bootstrap is awesome.
If you do care about the server, then you can start worrying about using MySQL, Oracle, Postgree or MSSQL, or mixing standard SQL with a NoSQL database like MongoDB, Cassandra or Redis, or mixing different languages, like making your own modules for PHP in C, or use Facebook's HipHop PHP to compile your PHP code to C++, but that's far beyond the scope of this entry.
What I want to emphasize is, use whatever you find fun, and pay special attention to the user interface, follow the standards and you will be fine, they are there for a reason.