Re: Function size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt <tijnema@xxxxxxxxx> wrote:

> I agree that large switch block are not always easy and useful to split,
> however, writing too much code inside a switch block isn't considered good
> practice too IMO. Though, it is unavoidable in some cases I think. I do
> have some of these functions in my code too, I have one switch block of
> more than 500 lines, but that's just because I have more than 400
> individual case statements, and I don't think there's a better way to do
> it. Doesn't mean I like it btw.


I never encounter such big switch statement in PHP yet. However I saw huge
switch and had to optimize it while  working with a custom programming
language interpreter written in C.  When I see the language is OO, I try to
apply polymorphic behavior and eliminate any switch statements. Here is a
video that demonstrated the concept
http://www.youtube.com/watch?v=4F72VULWFvc

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader

[PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [Find Someone]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux