TrojanWarBlade
Programmer
Anyone fancy a heated debate?
Well I thought I'd warm the place up a bit! ;-)
I've noticed that some of you guys like to use substr instead of regexs wherever you can. I guess this is generally a performance issue and in this respect I agree.
My issue here is that I think that speed is rarely that important or critical in these situations and I think that regexs are easier for people to understand.
Did I just say that?
Yep!
I don't mean that regexs are easier to understand, I mean that regex are often used to alter a scalar. In many of the cases I've seen here we have used "substr" to alter scalars.
The problem is that most people don't realise that substr can alter scalars. The general perception is that substr returns a section of a scalar and this idea has probably been generated by using other languages where that is indeed the case.
The problem as I see it is that for a (possibly modest and maybe even irrelevant) performace gain you risk creating code that is far less maintainable, not because it's bad but because it is subject to a common misconception.
There, I've said it. I've started the fire so let's see how many of you guys want to fan the flames!
What do you think? Agree? Disagree? We'll see.
Trojan.
Well I thought I'd warm the place up a bit! ;-)
I've noticed that some of you guys like to use substr instead of regexs wherever you can. I guess this is generally a performance issue and in this respect I agree.
My issue here is that I think that speed is rarely that important or critical in these situations and I think that regexs are easier for people to understand.
Did I just say that?
Yep!
I don't mean that regexs are easier to understand, I mean that regex are often used to alter a scalar. In many of the cases I've seen here we have used "substr" to alter scalars.
The problem is that most people don't realise that substr can alter scalars. The general perception is that substr returns a section of a scalar and this idea has probably been generated by using other languages where that is indeed the case.
The problem as I see it is that for a (possibly modest and maybe even irrelevant) performace gain you risk creating code that is far less maintainable, not because it's bad but because it is subject to a common misconception.
There, I've said it. I've started the fire so let's see how many of you guys want to fan the flames!
What do you think? Agree? Disagree? We'll see.
Trojan.