16 ms·
I chose PHP because it's gathers everything I hate about any language in one spot. * It has everything including the kitchen sink but nothing in the decor matc
by zaphar 15y ago
I chose PHP because it's gathers everything I hate about any language in one spot.
* It has everything including the kitchen sink but nothing in the decor matches. There is no unifying principle to help you grok the language
* The Community is all about quick hacky fixes to already broken code and this approach seems to flow from the core developers out.
* It's not type safe, not even at runtime. I don't know if I ever want to work in a language that doesn't have proper type safety as a guard rail. (Note I'm not talking about compile time vs runtime type safety I'm just talking about type safety period)
* The code is just plain ugly to look at and I used to be a pretty heavy perl coder so that's saying something.
I know some of these are pretty subjective but for me php just manages to hit every single one of my top programming language gripes.
If you want to know my favourite that's a much harder question to answer. Golang has been pleasing me lately although it's interfaces have a very tiny hole in the type safety.
ML and it's varying descendants have as close to my ideal type system as I've ever seen. But the chances I'll ever get to use it for a job are slim to none and it seems the community is a little too academic for my taste.
Lisp has the most awesome metaprogramming built in and I had a brief heady love affair with it until it's lack of good type safety brought me back to earth.
I suppose all this means I'm one day fated to write my own "ideal" programming language so it can be featured in a list like this :-)
- pepijndevos 15y agoI once found a login form where 1e3 was a correct password, when yours was 1000. I'm still not sure if it eval'd your password, but it was PHP for sure.
- wizzard 15y agoWhat does this have to do with faults of the language? I can think of a lot of stupid things to do in any language; it doesn't mean the language is the problem.
- rane 15y agoIt does if the language itself makes it easier for you to make those kind of mistakes.
- jonursenbach 15y agoIt's easy to make any kind of mistake in any language. Singling PHP out for it because some people are shitty programmers is BS, IMHO. Not all of us are asshats who have no idea what we're doing.
- scott_w 15y agoThe weak typing of PHP doesn't make life easier for the programmer in this instance. For example, this specific problem is harder to create in stronger-typed languages, since you would need to explicitly cast from an integer to a string.
- xyzzyz 15y agoWhat do you mean by type safety? Are all dynamically typed languages type unsafe by your definition?
- zaphar 15y agoIf the language can tell me when it executes the code that the type is wrong then I consider that type safe. Less usefully type safe than at compile time but safe nonetheless. If the language treats a string as a number in some cases without an error then that is most definitely not type safe.
- xyzzyz 15y agoWhat's the reason why you don't consider (Common) Lisp to be type safe then?
- zaphar 15y agoI prefer prefer strong statically typed languages. Just because php is at one extreme end of the spectrum of my preferences for type safety doesn't mean that other things can't be closer but not quite on my end of the spectrum yet.
- roryokane 15y agoThe standard term for the feature that allows treating a string like a number is "weakly typed". You like "strongly typed" languages.
- ScottBurson 15y agoLisp is type safe by that definition, so I'm not sure what your problem was with it.
- seanmcdirmid 15y agoDynamically typed is still typed. That the error occurs at run-time means the typing is dynamic. If the error did not occur at all (int was unsafely coerced into a string), then that would be untyped or weakly typed. Static type safety is desirable, dynamic type safety is almost essential. But they are both type safety.
- ticks 15y agoI think PHP's main problem on websites like these is that it's too mainstream of a language. It's like asking someone who's an avid fan of world cinema about the latest Michael Bay film. I'm not that interested in programming, so I think it's a great language. All those years back when first learning to use it, I remember going through a book and being so happy that it did practically everything itself.
- zaphar 15y agoYour second statements communicates to me that you like it because it's a toy language. It may be useful for just getting something small done and getting started but for someone who looks at programming as an enjoyable craft php loses it's shine. Especially once you've been exposed to other languages that highlight how much better it could be.
- EGreg 15y agoI actually disagree to some extent. I know, it's PHP. But it can do some pretty amazing things if you think in terms of files. If you're coming from a C background, it's actually quite nice. For example, you can use include ( ) in so many ways, autoload classes, write getters/setters and override anything, implement views, etc. Everything "just runs", or can be compiled into fast code with HipHop (or cached with APC). OK, to be fair, I would say that PHP with a framework that takes advantage of it can be very cool. I can't exactly share our codebase, but you can see the open source version from 2 years ago : http://phponpie.com http://phponpie.com to aprpeciate some of the "beauty" of PHP And it can be extremely expressive and powerful. Sure, it can't do everything that Node.js can do, but for serving requests it can be awesome. It isolates every script in its own memory space, so you never have to worry about anything! The one thing I do not like about PHP is that it's married to the outdated thread-based webserver model, while the new boys on the block (NGinX, Node.js and the new Apache) all use event-based programming. Don't downvote just because I said PHP can be cool. Look at our framework at least, before voting :)
- zaphar 15y agoActually I upvoted you. Just because I dislike PHP doesn't mean someone else can't like it.
- robomartin 15y agoWhat would you use in place of PHP to build a web app? The only requirement is that you have to be able to hire developers just as easily as you can hire PHP developers. This might be where rubber meets the road. It's easy to dislike a tool based on all kinds of criteria. In the real world one has to be able to get work done and, if needed, find developers to expand a team. Proposing a subjectively or objectively better language that does not have a large enough developer base to call upon when needed isn't really a business solution as much as it is an interesting academic exercise. To clarify, I have no feelings either way. I've had to learn so many languages over the years that I just see them as another tool in the toolbox. Life goes on.
- soc88 15y agoJust wondering ... what is "large enough developer base"? If you are hiring, you are not hiring 10000 people, you are hiring one or two people. If you can choose between a pool of 10000 developers in PHP and 100 in Haskell (whatever...) you will probably find more candidates you want to hire in the second pool. And it is certainly more likely that you find the appropriate candidate if you don't have to wade though hundreds of applications.
- robomartin 15y agoMy general point is that evaluating languages based on personal or technical preferences might just be a flawed metric. Unless what you are doing is a hobby you have to deal with additional criteria. I pointed out just one such data points. I, for example, really love APL. I would also never think of using APL as the basis of a commercial project unless there was an overwhelming reason to do so. A friend of mine built a nice company around a product built entirely around Forth. He loved the language. And, he lived to regret making that decision. He eventually paid gobs of money to have the entire code base re-written in C. A couple of years later he sold the business for several million. Potential buyers did not want to touch him with the Forth code base. Just a reality of business. To clarify, the potential buyers were not interested in the Forth code base because they did not use Forth themselves. Acquiring a company whose products were based around Forth would mean adding a new layer of developers to their team and, effectively, byfurcating their efforts and skill sets. A code base written in C was a no-brainier for most interested parties. With C on the table the language was just a check-box item that did not require further discussion. With Forth the discussions stopped right there. Again, nothing to do with the merits of the language and everything to do with business realities.
- duskwuff 15y agoPHP actually does have some type safety, amazingly. You can declare types on function arguments: function myFunc(ObjectType $arg1, array $arg2) { ... } And it'll throw errors if you try to pass an argument of the wrong type.
- zaphar 15y agoIs that new? I don't remember it from my php days. Although I'll freely admit those days were a long long time ago so "new" for me may actually be pretty old.
- pbiggar 15y agoIts been there a long time, I think since PHP 5. (Certainly, it was old in 2008, when I was working on PHP).
- georgefox 15y agoYou're correct. Type hinting was introduced with PHP 5, which makes it about eight years old. http://php.net/manual/en/language.oop5.typehinting.php http://php.net/manual/en/language.oop5.typehinting.php
- ElbertF 15y agoType hinting exists for objects and arrays but not for scalar types (string, int, float, bool) unfortunately.
- jasonlotito 15y agoFrom another comments, we established a time frame: > Is that new? I don't remember it from my php days. Although I'll freely admit those days were a long long time ago so "new" for me may actually be pretty old. So, what you are really saying is: > I chose PHP because it's gathers everything I hate about any language in one spot when I last used it... which was a least 8 years ago.
- rbanffy 15y agoI haven't seen an elegant pattern emerge from PHP in the last 8 years.
- jasonlotito 15y agoBeing blind isn't something to joke about. Mocking those with handicaps is rude and uncalled for.
- elimisteve 15y ago"Golang has been pleasing me lately although it's interfaces have a very tiny hole in the type safety." Go/Golang is indeed an amazing language -- my favorite, in fact, even beating out Python for my #1 spot. Go's creators guarantee its type safety; what hole do you speak of? To hopefully assuage your concerns and to make an assumption about what you may worry is a hole in Go's type safety... Empty interfaces allow one to contain _any_ value (such as a string) in an interface{}, but in order to use such a value, one must access the underlying type of the interface{} (i.e., the aforementioned string value). To do so, a type assertion is required, thereby preserving type safety... unless I'm missing something?
- zaphar 15y agoThe interface{} is a contributor to the hole but not the cause. The hole occurs when I want to make a generic container like say a binary tree. I can create a node interface that satisfies my needs for a binary tree. What I can't do is guarantee that at compile time every element in my container is of the type that I expect. If they ever add generics of some sort this hole will be closed. It's a very tiny one and can usually be limited to a single functions scope but it still exists and certainly not enough to make me dismiss the languange out of hand. You can see examples of the hole by looking at Go's container/* packages. Some of them had a completely separate implementation for each of the primitive types. Type assertions ensure type safety at runtime provided the programmer does their job. But it depends on the programmer doing their job so it could be better. Go and ML were two examples that come the closest to my "ideal" language. Go just happens to be one that I have the greatest chance of actually using in a job :-)
- luriel 15y ago> You can see examples of the hole by looking at Go's container/* container/* is a bit of a corner case which is rarely used, specially since append() was added to the language and container/vector was deprecated I can't remember the last time I needed anything from container/*.
- zaphar 15y ago
- jorisw 15y agoRespectfully, I think two of your arguments stink. 2) The community. Surely there's a lot of garbage code floating around in the community, but are we going to judge a language by its community now? Perhaps the community is so big it produces a fair amount of garbage code appropriate to its size? 4) Ugly to look at. Perhaps, if you write ugly code. Again, this is about the programmer and not about the programming language. I think I write pretty code. Disclaimer: I am a PHPer most of the time. But I realize that PHP is probably on its way out in the long run. And I agree with your two other points. I chose ActionScript because it's a PITA to debug. Good programming languages make it easy to find your mistakes. PHP is good at that, as are a bunch of other languages.
- zaphar 15y agoRespectfully they are subjective so I expect people to disagree. However: The community is a huge part of judging a language. You'll note that I specifically said this appears to flow from the core developers out. A sentiment many in this thread appear to have shared. That to me is a danger sign. The community often is a signal regarding how the core devs of the language approach things. As for beauty it's completely and purely subjective so what looks beautiful to one person can look ugly to another.
- kamaal 15y agoSo in short according to you the language is useless if doesn't have type safety?
- wallzz 15y agoI always compare those who program in PHP to those young teen who are rushing to Justin Bieber Concerts ,and to the cinema just to watch Twillight ,and they are so exited ,but they ignore that there is a hole world out there ,where music is not judged by appearances,and movies are not judged by makeup and love scenes,and where there is some powerful programming languages that let you enjoy building a scalable ,powerful projets in some hours.