Reply to Re: Reducing code clutter

Your name:

Reply:


Posted by Kenneth Downs on 06/24/05 23:46

Peter Salzman wrote:

> Kenneth Downs <knode.wants.this@see.sigblock> wrote:
>> Peter Salzman wrote:
>>
>> > Hi all,
>> >
>> > Newish PHP programmer here. I wrote a form select class to help reduce
>> > code
>> > clutter, but I don't think the effort was worth it. I was hoping to
>> > post my attempt and get some ideas from more advanced users on how to
>> > implement a select form using less lines of code.
>> >
>> > First the select form class which implements a select widget. I'll
>> > post only the relevent parts:
>> >
>> >
>>
>> Pete, IMHO the value of abstraction of this sort in a short-transaction
>> environment like the web is severely overrated, to the point of being an
>> obstruction to productive work. Did you by any chance come from a
>> desktop dev environment?
>>
>> My own work is all around databases. If yours is also, you may benefit
>> from
>> what I did. It centers around having a data dictionary specifying what
>> the columns are in all of the tables (it is much more than that, but that
>> is a
>> good introduction). When it comes time to generate HTML widgets, you
>> read the dd and look at what kind of columns you have and generate
>> appropriate widgets (mostly textbox, textarea, and SELECT lists).
>>
>> If you can give more context about the kind of site you are working on
>> perhaps myself or others can give more details.
>
> Hi Ken,
>
> I'm not a programmer by trade. It's just something I really enjoy doing.
> I'd rather program than anything else in the world. I'm actually a
> physicist by trade (well, a grad student by trade, but will soon be a
> physicist by trade).

Can appreciate that double life. When I was supposed to be doing Maxwell's
Equations I was usually off hacking somewhere. Hence I am programmer by
trade with a BS Physics.

>
> I'm writing my own blog, so I fit under your "short-transaction" model. I
> know there are more blogs out there than you can shake a fist at (some
> quite good), but I wanted an excuse to learn sessions, SQL and using
> mysql/sqlite/pgsql securely with PHP.

This is a perfect way to learn those things. The existence of those blogs
gives you a standard against which to measure your efforts.

>
> The blog itself has been a wonderful learning experience (I've only
> written 3
> posts, although I've spent an awful long time writing the blog itself!).
> My sole interest, really, is to become a better programmer and to have fun
> doing it.

My suggestion is Ken's Umpteenth Law: Don't Abstract Against Non-existent
Cases. You are introducing a level of abstraction far above what is
required for a blog. Further, you are doing so without the intuitive feel
that comes with more years of experience, so you are risking entry into the
hall of mirrors, where you will be lost, forever lost. Therefore, commit
to writing a decidely NON-ABSTRACT blog that does what it is supposed to
do. Then gradually refactor the code to create general-purpose routines
wherever you see repetition.

Hope this helps.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация