|
|||||||||||||||
Current Texts Comic Imprint Calendar Search PHP-Classes Container-Wizard main.s21 |
|||||||||||||||
Categories
{{login}}
|
Some Design Notes about "Classes for your pleasure"
Until now, I haven't come up with a proper name for what I put online a few months ago as "Classes for your pleasure". They are my third generation of an object oriented toolset so far (let's not speak about what existed before, shall we?). The prior generations never made it into a wide public, but the second one was truly successful: a set of classes which would allow me to create web applications really fast. I think the proper name for such a tool would be a "RAD framework". I briefly looked into other frameworks, in PHP and other languages. From what I saw, I expected to face the same problems, if not worse. You've got fancy acronyms there, MCV and ORM and whatever. Everything links together and there seem to be big "God classes" that are in charge of everything. Which led me to expand my rule of thumb: I'll have 100% of Framework, of which I will use 20% to have 80% waste my resources while I'll be able to attain 80% of what I want and make the remaining 20% a pain in the ass. Which is added by the fact that these "MCV-driven (or whatever) tools" will force me to follow their approach in whatever I do. No thanks. My primary idea with the class collection is to go away from programming "machines" toward programming their components. Instead of starting with a class "Pump", I'll do a piston, a switch, a hose, a cogwheel, a shell and so on until I've got enough components to build my pump. Having a class Switch will save me time to write the same code over and over again. That is exactly what object oriented programming is perfectly suited for. Often, people will scoff at this approach as being to abstract and gloat about being "pragmatic" and "getting stuff done". Yes, sometimes it is reasonable to be pragmatic. But often enough, I was "pragmatic" and wrote a quick and specific class for a project, only to have a colleague glance on it and say "Hey cool, can't you use that for my project too?". Another, more general design principle which I keep in mind and which is intertwined with the extension aspect is the aforementioned 80/20 problem. Imagine the different, thinkable needs you may have in the future and which might be solved by a class you're about to code. It is a set of circles, which will intersect in a large area and have a space outside the central circle, the special needs. If you want to care about every possible set of needs, you possible end up with version 4.4.2 of a fat, buggy class which starts to reach the extents of the Linux Kernel. One example is the Wikiparser I wrote - I rewrote it five times until I liked it. I thought about making it possible to have it present tables. Or format images with text-flow attributes. Or have a possibility to change a font scale or color. But no. 99% percent of my text is simple text with paragraphs and breaks. Why mess around reinventing another markup language and writing a parser which will turn my markup into HTML when there is already HTML? So I just added an on and off switch, which gives me a possibility to turn of the parser anytime. Which will add security related issues, because anyone could add anything as html, like I do here, but then again, the purpose for my wikiparser is to serve in websites for a closed user groupSo, while enjoying the automatic ease of just typing in text without having to add <p> and </p> every few minutes, I still keep the full flexibility of basically doing everything I want. At the moment, the project is not exactly usable, at least not for the wide public (but imagine what powers my site here). Problem is that I have to few classes online, some are missing yet and I'm still in the process of developing design. CommentsPlease note: comments posted won't be visible immediately, as they will be checked for harmful content. |