On Thu, 19 Mar 2020 17:48:31 +0000, The Natural Philosopher wrote:
> On 19/03/2020 13:18, Martin Gregorie wrote:
>> So, can any of you do better, i.e. write a regex that CAN validate the
>> syntax of an e-mail address in terms of its structure and the set of
>> permitted characters on the username and domain parts (the permitted
>> character sets are not the same).
> No. That's why I don't bother with regex, ever.
>
> Its far faster for me to write a series of tests in 'C' then try and
> work out what random gobbledygook will do the job in regex.
>
> Regex is for nerds to impress other people with. Its not a smart way to
> program.
>
I won't argue with that.
> Same as SQL. By the time you have taken a day to write the SQL query
> that does everything you want, only to realise it takes 50 minutes to
> complete, you could have written most of it in C and got it down to 3
> seconds...
>
Here I DO disagree.
SQL is fine unless you insist on writing huge, do-everything queries. I
was involved with one of them years ago as part of a benchmarking
exercise and that pretty much put me off writing that sort of thing for
good. Never tried SQL procedures either, but concise SQL queries used
judiciously within logic written in C or Java work very well and are easy
enough to write and maintain.
Most SQL performance problems, IME anyway, boil down to crap database
design, meaning bad or nonexistent normalisation and incorrectly placed
or missing indexes. But, given that a relational database has a decent,
user-friendly query analyser and there's enough realistic test data its
generally quite simple to get the speed up to where it should be.
Of course, if the DBA can't normalise and doesn't understand an ERD,
and if the system designers only provide small amounts of largely
imagined data rather than a few hundred or thousand actual business data
items, then OF COURSE the database performance will be crap.
Don't ask me how I know that: I've been called on too many times to fix
that sort of mess. But sometimes the clients got it right. In one project
it was very nice indeed to be given half a million records of valid test
data. That was for the last major DB I worked on: I did much of the
design and then tuned it using that huge pile of actual data. It really
sang from the off.
--
Martin | martin at
Gregorie | gregorie dot org
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|