web developer & system programmer

coder . cl

ramblings and thoughts on programming...

all skills comes with interests

published: 15-04-2012 / updated: 15-04-2012
posted in: development, programming, projects, rants, tips
by Daniel Molina Wegener

As you know I was working for various medium companies along my career, until I have become a freelancer. In one of those companies, where most programming contracts were made to Informatics Engineers as Software Engineers as role. You expect at least from a Software Engineers the capacity of doing research on almost any topic related to the given programming task and a very good quality solution to the given problem. That was not the case always, as it happens on many areas, not only in software development. Today I will present a story illustrating how something what is done without interest will make you waste your time and money.

The most common job position in the last decade in software development is the Web Development. Almost everyone wants a Web Application, something that can run on a browser, without doing too much effort porting an application to desktop applications and similar stuff. So, most software development contracts are based on the Web. If you study something related to Informatics Engineering or Computer Science related topics, you cannot expect that they will prepare you for an immediate job position, and even you cannot expect that you will finish studying that career knowing everything related to it. Studying a career has the intention to get the basic knowledge on certain subject, enough to understand books that will bring you the proper expertise on that subject. Then you can do an MSc and you will be an expert on a small subset of topics covered by your career, also you can do a PhD, and you will be an expert discovering new stuff on a very specific subject of interest. You can read this wonderful article entitled «The illustrated guide to a Ph.D.» and you will see what I am referring to.

But if you do your stuff without interests, you will not learn, and you cannot drag any guilty to your environment about not learning enough to reach a good level. Everything is subject of interests, getting a graduate level on any career is not subject of decorating your room with a nice diploma, or showing a good position in your resume.

So, if you decide to get employed as Software Engineer on a Web Developer role, at least I am expecting from you that you will be able to read the Hypertext Transfer Protocol Specification and solve almost anything related to that protocol. A small team in one of those companies was working with a very specific service, mounted over HTTP/1.0 over a standard Apache Tomcat server. Rather than using SOAP or similar protocols, the service was working with HTTP POST parameters, and returning XML as content response. But they were stuck two days trying to solve a small problem. The HTTP client library that they were using was keeping the connections open and not closed, leaving many HTTP connections open on subsequent requests. If you know a little about browsers, probably you know that they are using — almost all of them — Keep-Alive connections. So, if you want to research what makes an HTTP client to use Keep-Alive connections, you should start searching for keep-alive and negotiation keywords over the document.

An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header including the connection-token “close” was sent in the request. If the server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close. [Hypertext Transfer Protocol -- HTTP/1.1, Section Negotiation, first paragraph]

So, the right header to search for is Connection, which controls the HTTP/1.1 behaviour during the protocol negotiation. This is not CURL, which uses a closing connection negotiation due to its nature, which is not the nature of a common HTTP client which uses the standard specification.

HTTP/1.1 defines the “close” connection option for the sender to signal that the connection will be closed after completion of the response. [Hypertext Transfer Protocol -- HTTP/1.1, Section 14.10 Connection]

Finally, took me two hours to solve the problem reading the HTTP client library documentation and the HTTP/1.0 specification. The previous hack of destroying the client instance to avoid open connections was removed and the client library started its works using the proper standard behaviour. So, everything is subject of interest. The server was working with the right behaviour, not as some team members were thinking about bugs on the server. All those headaches were subject of a lack of interest on the issues to be solved. I just imagined how many lines of code were dropped and inserted trying to reach the proper solution guessing which API call would close the connection, trying to use many API calls, and just one extra line of code has solved the problem.

httpRequest.setHeader("Connection", "close");

Getting confused if you are under pressure is natural, I accept that. Also I accept that here in Chile being a programmer — now called Software Engineer — is not one of the most coolest job positions on the market. It will never will be well paid as manager position. But the lack of interest is not subject of where did you have studied. Probably making a complex career which requires reasoning, reading and effort, is something boring with pressure and not well paid job positions is causing that lack of interest, where most Software Engineers do not work on that job position for a long time. And this problem is not subject to be treated on a classroom, they just will bring you the basis. Reading and enhancing skills is your own responsibility.

No coments yet.

post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>