RESTful URLs and the laziness...

One of the other stuff apart from Search which I worked on the site's code at  was to make the URLs truly RESTful.

While the URLs earlier were pretty decent and URL, but when viewed they did not used to represent the item which was being viewed. They would just mention the name of the item in the url, and it was kind of broken.

Also, its not good from the serch engines point of view. So I took it high on my agenda and did a lot of  on how to accomplish the same.

There are  a lot of plugins and code snippets available, through which you can accomlish the same.

Some of the methods required to make a separate slug column in the database table for the same.

All this while I had been wondering that why so much of code need to be written or in fact even a modification in the database trouble would be required.

Since I am not too much conversant yet with the nitty gritty of programming and PHP, so I could not fathom that out soon.

But, I was clear after so many months of looking at the code and some basic of fundas that it should not be so much of fuss.

Finally I got hold of the "Inflector" function and all it required was basically 28-35 characters change in the code to make the URLs completely RESTful.

Earlier, when I read that programmers are basically lazy people and they usually want to write as less code as possible, I just could not digest that.

But in this case, this hold good for me, I was all the while looking for a shorter and a easier method also, because the methods which I studied till then were all too cumbursome for me to implement.

I have also joined the lazy band of programmers! 


Popular posts from this blog

Coursera - CS 101 - Completed