Tuesday, July 10, 2012

New parameter besides POST and GET

"Comment Your code. Do the tests first. This forces You to think WTF it is that You're doing."

This is how I commented my friend when he said that he had wrote code that he doesn't know that the f*k it does, but it works. You don't do anything with code if You don't know what it does. Would You agree?

The bug I had earlier in my framework about mixing traditional and this custom way of GET-parameters fails - has been fixed. But if I give parameters in URI like this:

/YourController/itsMethod/someParam:value/fuu:bar/

and interpret it as request for controller "YourController"s method "itsMethod" and parameters "someParam" = "value" and "fuu" = "bar", then the parameters are not GET-parameters. Those would be given like: "?someParam=value&fuu=bar".

But what are they? I think I need to give them some sort of name.

Naming stuff is hard. I want to give describing name that actually means something but doesn't have risk to be confuced with something else. Name "URI" would confuce to beleave that it's the whole "Uniform resource identifier". The usage of these parameters would be to refer to certain ID:s, for example like:

/User/view/id:145/ or /Page/show/pid:37/

But naming the parameter just "ID" would not tell the whole story. And concider the code $_ID['id']… Don't like it. But how about "UNIQ", short from "unique". $_UNIQ['id'] is much more like it. Let's think the URI again for second, code $_URI['id'] could be read like "part 'id' from 'URI'" - but that is exactly what it is. No matter if one would use it as something else than identifier, the concept would still be correct. URI "/User/list/start:15/limit:50/" would have parts "start" and "limit".

It is desided then: In my framework there shall be three kind of parameters, GET-, POST- and URI-parameters.


And more about naming stuff. I previously named my framework "JSFramework". Well, it has obvious risk being confused as JavaScript framework when it in fact is a PHP framework. A colleague of mine wrote that writing my own framework rather than using existing "proves my hubris". After googling I found out that hubris meas extreme pride and arrogance. Being one of the three virtues of a programmer, I take it as compliment.

In Finland we have this saing "Siitä se ajatus sitten lähti", roughly "That's where the idea began". How does Hubris Framework sound like?

And the CMS? To be honest, would You use content management system named "Keijo" (traditional finnish male name). Today I came up with another name: "Cimbic". "Cms I Made Because I Can". It also appears to be a name - apperently lastname and name of a company. But I doupth naming my CMS that would in any way be a problem.



- Joona

1 comment:

  1. "It is desided then: In my framework there shall be three kind of parameters, GET-, POST- and URI-parameters."

    Why?

    - Nizze vaan.

    ReplyDelete