Live data from Hacker News

How not to check the validity of an email address

dellsystem.me

191–200 of 243 posts

Re: How not to check the validity of an email address

#191
post #175

Every single legacy application I've ever worked on has had analogous code buried in it somewhere. An application I've just been "repairing" recently has a spot where it uses two separate queries to pull two full table sized lists of values, then manually joins them with a loop, and then manually re-orders the joined values into groups selectively ignoring some rows, and then embeds the the whole reordered list in a…

I'm starting to really dislike the term "legacy code". It implies the code is bad because it's old. It perpetuates the misconception that code gets "stale" and problems build up. But that's not true. "Legacy code" is bad because it's BAD. All code is "legacy code" because unless the project is brand new, it has some history. We just don't call good old code "legacy code" because it hasn't caused us any problems. Ther…

Code sitting on the same machine can keep on performing the same way forever.

But other things change. The library changed its interface. You coded your crypto lib when MAC-then-Ecrypt was all the rage. You aren't handling HTTP/1.0 headers. Windows 7 doesn't even have those 16-bit drivers any more.

I hate the "throw everything away and rewrite with the brand new frame work every two years" that some parts of the web development community seem to have (and then get angered when you ask about a version over six months old because it is what you installed everywhere). But sometimes software does rot if it's old and no one is trying to keep it up-to-date.

Re: How not to check the validity of an email address

#192
post #173

Earlier quoted context omitted.

Potentially, I can construct an independent statement to adequately convey my innervation to your statement of factual basis, that while being grammatically correct, purposefully adds needless complexity to the original statement of intent I am adequately attempting to convey. Should I?

What are you talking about? If it's somehow clearer to say if (x == true) instead of if (x), why isn't it also clearer to say if ((x == true) == true) instead of merely if (x == true)? And so on?

Huh. You sound just like me 5-10 years ago, everything black and white.

There is a grey zone in the middle, move in there.

Re: How not to check the validity of an email address

#193

A timely reminder to everyone: http://thedailywtf.com/ is still going strong! Be there or be ... competent?

I quit them when Alex tried to takeover Programming Praxis by force when negotiations didn't seem to be moving fast enough for him.

Re: How not to check the validity of an email address

#194

Earlier quoted context omitted.

As expected. :) Just click the downvote button on my comment. Don't bother to explain anything. Oh, I know, you disapprove I called you smart. Sorry about that.

I've been on HN for a while (lurking), never seen a downvote button but here people referencing them on occasion. Why do I not see downvote buttons? Or is this some inside joke?

You need 500 karma to get a downvote button.

"Why don't I see down arrows?"

http://ycombinator.com/newsfaq.html

Re: How not to check the validity of an email address

#195

Earlier quoted context omitted.

As expected. :) Just click the downvote button on my comment. Don't bother to explain anything. Oh, I know, you disapprove I called you smart. Sorry about that.

I've been on HN for a while (lurking), never seen a downvote button but here people referencing them on occasion. Why do I not see downvote buttons? Or is this some inside joke?

Not all users can downvote things, I'm not sure if it's directly tied to how much karma you have but it's a measure to give more weight to the opinions of the more respected members of the community instead of anyone who has an account. Hopefully this will mean that Hacker News never turns into Reddit.

Re: How not to check the validity of an email address

#196

I've once come across: if (!Boolean.FALSE.equals(aBoolean)) { // ... } I was pretty baffled.

Came across this one yesterday, slightly paraphrased: boolean updateMsg(boolean pPassed) { if (pPassed) { incrMsgCounter(); logger.info("Message sent"); } else { logger.info("Failed to send"); return false; } return true; } Yes, the calling code actually checked the return value. The code is full of stuff like this. Somehow I've got a morbid fascination and can't stop marvelling at how grotesque it is. It even overpo…

What's so bad about this one?

Other than its returning a boolean being pointless, I mean?

Re: How not to check the validity of an email address

#197
post #119

Earlier quoted context omitted.

The first time someone wanted to hire me was even before I started college. "so how much will you bill me?" "Well right now I get 7€ (9.2$ at current rate) for unloding trucks ..." He interupted me before I could finish the sentence and demand 8€. "I can not pay you 7€! taht is just to much!" Sooooo I declined but someone took the job ... for under 8$ an hour. How much quality can you expect for that price???

This sadly still happens. I remember looking through Craigslist jobs and legit companies wanting someone with html/css/javascript/php experience for $8/hr, kid you not.

Part of the problem is, it's difficult to convince companies that (html/css/js/php) coding work is worth something, unless the company you're working for is actually a startup. Especially when they say "Can't you just do it in Wordpress, or Wix or something?"

Another part of the problem is, developers take that work. I probably would myself. I'd hate myself for it but if I have to take shit pay to make ends meet I'd rather do it coding than not.

Re: How not to check the validity of an email address

#198
post #192

Earlier quoted context omitted.

What are you talking about? If it's somehow clearer to say if (x == true) instead of if (x), why isn't it also clearer to say if ((x == true) == true) instead of merely if (x == true)? And so on?

Huh. You sound just like me 5-10 years ago, everything black and white. There is a grey zone in the middle, move in there.

There's grey zone and there's being obtuse. We're not talking about fancy tricks here - the clearest way to retrieve the truth value of a boolean variable is to refer to it directly, not comparing it for equality against a constant.

Re: How not to check the validity of an email address

#199
post #192

Earlier quoted context omitted.

Huh. You sound just like me 5-10 years ago, everything black and white. There is a grey zone in the middle, move in there.

There's grey zone and there's being obtuse. We're not talking about fancy tricks here - the clearest way to retrieve the truth value of a boolean variable is to refer to it directly, not comparing it for equality against a constant.

That might be the clearest way for you to write it today, though I'm talking about it being clear for someone else to read many years from now.

As so many posts on HN have said lately; writing code is easy, it's the reading that's difficult.

Re: How not to check the validity of an email address

#200
post #175

Every single legacy application I've ever worked on has had analogous code buried in it somewhere. An application I've just been "repairing" recently has a spot where it uses two separate queries to pull two full table sized lists of values, then manually joins them with a loop, and then manually re-orders the joined values into groups selectively ignoring some rows, and then embeds the the whole reordered list in a…

I'm starting to really dislike the term "legacy code". It implies the code is bad because it's old. It perpetuates the misconception that code gets "stale" and problems build up. But that's not true. "Legacy code" is bad because it's BAD. All code is "legacy code" because unless the project is brand new, it has some history. We just don't call good old code "legacy code" because it hasn't caused us any problems. Ther…

In 'Working with Legacy Code', Michael Feathers defines legacy code as code without sufficient tests.

The great thing about this definition is that it doesn't matter how old the code is - if it can be changed without worry about introducing unwanted behaviour because of test coverage, then it's not legacy.

It also means that you can write new legacy code right now!

Post reply on HN