Maybe MySpace users are the most likely to install site-tracking spyware, and so get their hits to MySpace counted; while someone else may have a bit more intelligence, ignore some spyware, and not get their hits to other sites counted. Just a thought.
PHP is horrible inconsistent
on
PHP Hacks
·
· Score: 1
I've watched a few people trying to program in PHP, and they all follow the same pattern: go to php.net, find the function they want, write a bit of code, test. Go to php.net, find, write, test. This was nice, they could just be learning, everything was fine.
However, they were still having to look at the php.net manual a month later. That isn't fine. Come on, you've been using PHP for a few weeks now, surely you can remember which function it is, how it's spelled, and what the arguments are by using it a few times?
I don't care about speed, most scripts are fast enough that you can't tell the difference. I don't care about those horrible ideas of the past like register_globals (please don't mention that again) and magic_quotes (which are unbelievably STILL on by default). I don't care about the hacks and 'features' that PHP implements poorly, like regular expression support. I don't care about PHP's weird typing system. I want to know why is PHP so horribly inconsistent like it is?
I want to escape a string for MySQL. Which function do I use? addslashes()? mysql_escape_string()? Nope, mysql_real_escape_string(). There are about ten different functions for escaping strings, all of them different.
I want to find a string in a string. I know that one, it's strstr(haystack, needle). Hang on, now I want to use a regular expression. preg_match(needle, haystack). Why the pointless argument-switching?
I want to convert binary to hex. I know of the function strtolower(), so I use bintohex(), right? nope, bin2hex(). Don't ask why.
I want to encode HTML. I remember the function (I think), isn't it html_entities()? No, it's htmlentities. More pointlessness. Why do away with the underscore?
The excuse they use is that it's friendlier for people coming from these toolkits: C uses strstr, mysql uses things with underscores. I don't know about some people, but I'm able to learn a new way of doing things, especially a new way that doesn't find me tearing my hair out several days later.
For something that's supposed to have had a small team of close developers, it doesn't look like it. Look at any long PHP manual page. Half the functions have underscores in them, the other half don't. The string functions are especially weird. Some of them seem to be of the form str_foo(), some of them are strfoo(), others are neither.
PHP developers, seriously. You may have found PHP, but looking at the manual all the time is not the usual way to program. With pretty much any other language I learned, I've been able to keep the feature set in my head easily - consistent, either it uses underscores or it doesn't, function arguments don't change around for similar functions, stuff like that. I became annoyed at looking at the PHP manual every time I wanted to use a function. array_push( array, 2 ) or array_push ( 2, array )? See, I can't even remember how those arguments go.
Right, back to your post. I'm not saying that it's not possible to write a lot of good code with PHP - you certainly have, and I've written my fair share of lines in it. I just find that PHP is a pain to write. Instead of coding, I spent more time thinking "is this the way I have to do it?"
Everyone is saying "oh it's not much money to Microsoft, so Microsoft can't lose". Firstly, I'm sure whoever is suing them doesn't care about dealing a big blow to Microsoft, and will be satisfied with the money.
Secondly, when someone sues a big company, and said big company plays a role in your business, you might take notice. "What are they suing for? Are their products defective? Can we sue them too?" If someone sues you, it doesn't look good, and a CEO from another company might then read about WGA, and become more worried about using it. Microsoft couldn't care less about what happens to the individuals who use their software, but Microsoft gets its money from the corporations, and if enough have to sue to get WGA removed then so be it.
Everyone has interesting data. Most of my e-mails could be considered "boring", but they're interesting enough for Google to search through them to generate ad keywords so they can show ads at me.
An MP3 collection leads to "buy this type of music!" ads. Photo albums (with tags) lead to "Go to this place!" ads. There's a lot that can be found out from your files, even if you think they're uninteresting.
I wonder why no-one uses Windows Update as an example of how stupidly insecure IE can be. It is a website that, using built-in browser features, is allowed to delete and modify critical system files, with no complaint from the OS.
A little ActiveX here, a little social engineering there, and you can be hosed in minutes...
It's amazing how you can be automatically Insightful for bashing this place now. If someone's wrong about something, don't whine about some 'groupthink', try to correct whoever it was, which actually helps. Explain why this isn't how the patent system is supposed to work. Anyway here's my opinion on the matter.
I think of it like this:
If I break into your house and steal all your money, that is bad and I should be punished for it.
If I break into your house because you stole my computer and I want to get it back, I might be more justified in doing so.
Sure, it's a lot more complicated than that - in either case, I've got a charge of breaking and entering to deal with. Likewise, patents are going to be controvertial whatever happens.
I don't like Microsoft that much. I don't like their business practices, their software, or their vast army of lawyers and patents, and anything that hinders any of those things is good by me. Then again, I'm also against these software patents, and I'm not sure if this one should've even been granted, let alone used.
Using a patent against Microsoft is making the best of a bad situation. Obviously, I'd rather see them both without any patents, like I'd rather not have my thing stolen and have to break into your house to get it back. This is just the next best thing.
"Hey, mr online music seller slash music buyer! Don't be supporting iTunes just yet. Microsoft are developing a system, it's going to be really really good! You can go with trusted Microsoft products! Ignore that Apple thing for just a while longer!"
I've made a habit of ignoring any vapourware announcements from Microsoft like this one. They really are worthless. No dates for anything, no estimates, not even a name yet!
I have to wonder if OOo gets popular enough they will demand that it be removed too.
Even if they could, I don't think they would. I think Adobe would rather see their PDF format used as much as possible (such as including it in OpenOffice) than suing and losing a bit of market share.
Almost all of which are named exactly the same as the underlying library functions they represent.
I know this, and it's just an excuse. "The bricks for this house are all misshapen!" "Well, the people who made the bricks made them how they used to." "So the house will fall down!" "But... people... not my fault..." Every other language I know has functions that are consistent, either likeThis or likethis or like_this. Only in PHP is it all three.
And disabled by default.
Really? I have never, ever seen them turned off by default. Except in PHP6, but that isn't released yet.
switch/case construct
That annoys me too. There's probably a reason for it, albeit not a very good one.
do...unless construct, which I've never heard of before
Me neither. If it exists, it probably does something unless something is true. Surely you can work that out!
It's as though the language was designed to encourage bad habits, and that's not a first language I would recommend.
I'd agree with you here, if you were talking about PHP. (Sure, Perl is a bit mushy, but that's not the point). PHP does have its share of bad habits: Only two scopes (global and function, this gets me every time), how you don't need to declare variables (why is my variable not being updated?), really, really weird arrays that combine lists and hashes, etc.
PHP, eh? I'm sorry, but PHP has its own set of bizarre quirks, that most people who know PHP can't shake off its bad habits. Inserting code in HTML is nice for web development, but nasty for everything else (most things that a new coder would be doing). Waaaaay too many functions that are very inconsistent that would confuse someone who doesn't know which one to use. Magic quotes are sadly still there, "Why are there \s in my words?". You may think that PHP's nice for web development, but don't start the guy off on the wrong foot.
I would learn something like Perl or Ruby or Python, which still have your advantages {interpreted, string manipulation, file handling, and not overly complicated}, and the added advantage of being good.
When Slashdot runs a story of screenshots of KDE, Gnome, a Linux Install program, it's usually when there's a new version out and screenshots are actually necessary. This 'article' doesn't offer anything I haven't seen before. New GUI? Yep. That annoying security account thingy? Nothing new. Someone trying to make Vista seem better? Yes, still there.
Good against Jabberwocks, though.
Maybe MySpace users are the most likely to install site-tracking spyware, and so get their hits to MySpace counted; while someone else may have a bit more intelligence, ignore some spyware, and not get their hits to other sites counted. Just a thought.
Slashcode converteth.
I've watched a few people trying to program in PHP, and they all follow the same pattern: go to php.net, find the function they want, write a bit of code, test. Go to php.net, find, write, test. This was nice, they could just be learning, everything was fine.
However, they were still having to look at the php.net manual a month later. That isn't fine. Come on, you've been using PHP for a few weeks now, surely you can remember which function it is, how it's spelled, and what the arguments are by using it a few times?
I don't care about speed, most scripts are fast enough that you can't tell the difference. I don't care about those horrible ideas of the past like register_globals (please don't mention that again) and magic_quotes (which are unbelievably STILL on by default). I don't care about the hacks and 'features' that PHP implements poorly, like regular expression support. I don't care about PHP's weird typing system. I want to know why is PHP so horribly inconsistent like it is?
I want to escape a string for MySQL. Which function do I use? addslashes()? mysql_escape_string()? Nope, mysql_real_escape_string(). There are about ten different functions for escaping strings, all of them different.
I want to find a string in a string. I know that one, it's strstr(haystack, needle). Hang on, now I want to use a regular expression. preg_match(needle, haystack). Why the pointless argument-switching?
I want to convert binary to hex. I know of the function strtolower(), so I use bintohex(), right? nope, bin2hex(). Don't ask why.
I want to encode HTML. I remember the function (I think), isn't it html_entities()? No, it's htmlentities. More pointlessness. Why do away with the underscore?
The excuse they use is that it's friendlier for people coming from these toolkits: C uses strstr, mysql uses things with underscores. I don't know about some people, but I'm able to learn a new way of doing things, especially a new way that doesn't find me tearing my hair out several days later.
For something that's supposed to have had a small team of close developers, it doesn't look like it. Look at any long PHP manual page. Half the functions have underscores in them, the other half don't. The string functions are especially weird. Some of them seem to be of the form str_foo(), some of them are strfoo(), others are neither.
PHP developers, seriously. You may have found PHP, but looking at the manual all the time is not the usual way to program. With pretty much any other language I learned, I've been able to keep the feature set in my head easily - consistent, either it uses underscores or it doesn't, function arguments don't change around for similar functions, stuff like that. I became annoyed at looking at the PHP manual every time I wanted to use a function. array_push( array, 2 ) or array_push ( 2, array )? See, I can't even remember how those arguments go.
Right, back to your post. I'm not saying that it's not possible to write a lot of good code with PHP - you certainly have, and I've written my fair share of lines in it. I just find that PHP is a pain to write. Instead of coding, I spent more time thinking "is this the way I have to do it?"
Oh, and its Unicode support is terrible too.
Maybe it's some sort of time travel thing like they do in time travel stories
That's a bug, it'll be removed from the Vista version.
Well, of course. Microsoft can't improve IE too much, because then there'd be nothing left to market the next version with.
what?
Everyone is saying "oh it's not much money to Microsoft, so Microsoft can't lose". Firstly, I'm sure whoever is suing them doesn't care about dealing a big blow to Microsoft, and will be satisfied with the money.
Secondly, when someone sues a big company, and said big company plays a role in your business, you might take notice. "What are they suing for? Are their products defective? Can we sue them too?" If someone sues you, it doesn't look good, and a CEO from another company might then read about WGA, and become more worried about using it. Microsoft couldn't care less about what happens to the individuals who use their software, but Microsoft gets its money from the corporations, and if enough have to sue to get WGA removed then so be it.
No idea. It's from the Mac version of Sim City 2000 when you type in JOKE. I think the JOKE is on me though.
Everyone has interesting data. Most of my e-mails could be considered "boring", but they're interesting enough for Google to search through them to generate ad keywords so they can show ads at me.
An MP3 collection leads to "buy this type of music!" ads. Photo albums (with tags) lead to "Go to this place!" ads. There's a lot that can be found out from your files, even if you think they're uninteresting.
Is that the best you can do? It's exactly 39626920746/625 (or less exactly 63403073.1936) rods per hogshead.
I wonder why no-one uses Windows Update as an example of how stupidly insecure IE can be. It is a website that, using built-in browser features, is allowed to delete and modify critical system files, with no complaint from the OS.
A little ActiveX here, a little social engineering there, and you can be hosed in minutes...
I think of it like this:
Sure, it's a lot more complicated than that - in either case, I've got a charge of breaking and entering to deal with. Likewise, patents are going to be controvertial whatever happens.
I don't like Microsoft that much. I don't like their business practices, their software, or their vast army of lawyers and patents, and anything that hinders any of those things is good by me. Then again, I'm also against these software patents, and I'm not sure if this one should've even been granted, let alone used.
Using a patent against Microsoft is making the best of a bad situation. Obviously, I'd rather see them both without any patents, like I'd rather not have my thing stolen and have to break into your house to get it back. This is just the next best thing.
"Hey, mr online music seller slash music buyer! Don't be supporting iTunes just yet. Microsoft are developing a system, it's going to be really really good! You can go with trusted Microsoft products! Ignore that Apple thing for just a while longer!"
I've made a habit of ignoring any vapourware announcements from Microsoft like this one. They really are worthless. No dates for anything, no estimates, not even a name yet!
Mad scientist invents talking hammer.
I thought when you get that card you have to pay everyone else $50. And yes, I do think that is appropriate use of money.
4.64371564×10^27 atomic mass units, for the physicists
I have to wonder if OOo gets popular enough they will demand that it be removed too.
Even if they could, I don't think they would. I think Adobe would rather see their PDF format used as much as possible (such as including it in OpenOffice) than suing and losing a bit of market share.
Almost all of which are named exactly the same as the underlying library functions they represent.
I know this, and it's just an excuse. "The bricks for this house are all misshapen!" "Well, the people who made the bricks made them how they used to." "So the house will fall down!" "But... people... not my fault..." Every other language I know has functions that are consistent, either likeThis or likethis or like_this. Only in PHP is it all three.
And disabled by default.
Really? I have never, ever seen them turned off by default. Except in PHP6, but that isn't released yet.
switch/case construct
That annoys me too. There's probably a reason for it, albeit not a very good one.
do...unless construct, which I've never heard of before
Me neither. If it exists, it probably does something unless something is true. Surely you can work that out!
It's as though the language was designed to encourage bad habits, and that's not a first language I would recommend.
I'd agree with you here, if you were talking about PHP. (Sure, Perl is a bit mushy, but that's not the point). PHP does have its share of bad habits: Only two scopes (global and function, this gets me every time), how you don't need to declare variables (why is my variable not being updated?), really, really weird arrays that combine lists and hashes, etc.
Besides, Python and Ruby are still nice.
I'm not sure if this has to do with anything, but I get GMail from http: //mail.google.com/mail. gmail.com also works, though.
PHP, eh? I'm sorry, but PHP has its own set of bizarre quirks, that most people who know PHP can't shake off its bad habits. Inserting code in HTML is nice for web development, but nasty for everything else (most things that a new coder would be doing). Waaaaay too many functions that are very inconsistent that would confuse someone who doesn't know which one to use. Magic quotes are sadly still there, "Why are there \s in my words?". You may think that PHP's nice for web development, but don't start the guy off on the wrong foot.
I would learn something like Perl or Ruby or Python, which still have your advantages {interpreted, string manipulation, file handling, and not overly complicated}, and the added advantage of being good.
Something that was almost a chicken gave (eggless) birth to the original chicken.
The rate of evolution being as slow as it is, it's about 0% likely that a mammal (live birth) could give birth to a bird (egg laying) like that.
Maybe in Spore, though...
Indeed. I remember hearing this reasoning several years ago now. Slow news day, anyone?
When Slashdot runs a story of screenshots of KDE, Gnome, a Linux Install program, it's usually when there's a new version out and screenshots are actually necessary.
This 'article' doesn't offer anything I haven't seen before. New GUI? Yep. That annoying security account thingy? Nothing new. Someone trying to make Vista seem better? Yes, still there.