ImaginationOverflow

The knowings and experiences of a group of developers.

Monthly Archives: November 2010

How to Implement an HTTP Server : Part -1

In my college there is a course named Internet Programming, there we learn how to use HTML, CSS, JavaScript, ASP.NET and ASP.NET MVC, and all of other useful stuff when programming for the web.

One of the cool things that we do is make an Http Server (ASP.NET like) from scratch, in this segment of posts (don’t really know how much there is going to be) i will try to show how simple (or not) it is to make a functional HTTP Server in 3 different languages

  • C# – The first implementation.
  • Java – The second.
  • C++ – The last.

You are probably asking why the hell is this guy doing the same thing in three different languages, i have good reasons to do so, the first implementation is going to be in C# because i already have it coded xD, in java for the challenge ( we here are very, very sick of java, so doing something in it is always a challenge xDD ) finally in C++ simply because i haven’t done anything substancialy in this language and plain curiosity to learn using concurrency libraries in it.

Now introductions aside, lets talk about the simple (but complex)  thing that is HyperText Transfer Protocol.

Read more of this post

Anti Copy-Paste Movement

This post is directed at new programmers, something that I felt like sharing as I still see friends and colleagues doing this mistake, it hurts to watch.

I’ve started coding long ago, using my old friend HTML, and I used to get pretty excited by having many lines of code, huge and complex algorithms, that no one could understand, and by the speed of what I done all that. Back then copy-paste was my biggest, and only, friend as it would speed up my work alot, or so I thought, I had no idea what intellisense was back then, not sure it even existed.

But this as all changed, the last 2 years were a infinite loop of learning how copy-paste is my worst enemy. Maybe you’re also like I was and find copy-paste, maybe along with intellisense, a good tool to speed up your programming speed but let me explain how that is just wrong.

Every time I have to copy-paste I stop, take a deep breath, and I try to figure out why I should use the copy-paste. Most of the time, maybe all of it, is the need of using that pretty piece of code that you just made and is needed elsewhere, and for that there is an easy solution, if it’s more than 3 lines long, in my opinion it is worth of it’s own function. Yes, don’t be afraid of promoting that little code to a function. If it happens to have a bug and you copied it to 3 different places you will have to go to them all and correct it, and you may forgot that you copied to a 4th place. If it’s a function it is so easy to fix it, just correct that function and it all works well.

People used to tell me this before, like I’m telling you now, and I always thought they just were being dramatic, but now that I make bigger and more complex applications I often deal with bugs on functions that if were not made a function I would spend more time copying the correct code everywhere than to actually fix the bug.

No copy-paste, along with many tests, saves you from big headaches when trying to deploy your application.

Deploy

This blog is all about programming, its done by two guys and one girl that love to spend hours programming at any language (LIEEEE XD). The idea of this blog is to talk about our minor experiences in the world of coding, compilling, linking and deploying. You can expect posts of .NET, Java, C, Web programming, concurrent programming, SQL, frustrating stuff that we have passed, and lot of code.

About us, our names are João Silvestre, Diogo Cardoso and Ana Correia, we are senior students on ISEL (Instituto Superior de Engenharia de Lisboa) taking the degree of Informatics Engineering.

This is our way to give back to the big community out there that helped us before so many times.

%d bloggers like this: