Closed RWOverdijk closed 12 years ago
Hi.
If you like to use namespaces with RedBeanPHP you can use the namespacer: space.php This would basically be the same as a minimal namespace solution, i.e. RedBean/RedBean_OODB etc. Concerning the attitude: feel free to change my mind. Why should RedBeanPHP use PHP backslash namespaces? Why are the arguments (including those http://pornel.net/phpns/) invalid?
Cheers, Gabor
Let me start off by saying that I hate the backslash separator. I'm used to it now, but I really don't like the fact that it's a backslash. I'd rather see a forward slash (path separator).
Namespaces do more than just take up space and prevent naming collisions. It's a way of dividing actual packages from each other (if you wish to call them this).
I'd like to ask you to start with this article written by Matthew. You've probably heard of him :p
I do sort of agree with some points in that article (Yes, believe it or not I did read it before opening this issue. I also already knew about the namespacer thingy.) and mainly speaking about the flaws and reserved keywords. But namespaces are a recent addition so I can see this being dealt with in the future. Even if the don't, who uses the namespace Split, seriously. I thought this was a very good argument, with an invalid example.
If that article is not enough, then let me know what's holding you back. I'll try to tackle those for you. There's a reason they were added to the language, and why they're being used so heavily. :)
First, your own argument:
The fact that many people use a technique does not make it better.
Now let's talk about the arguments provided by Matthew:
In general, my philosophy is to use as little language features as possible, I am a minimalist. Given a complex solution and a simpler one I prefer the latter. I adopt a more complex solution only if the benefits outweigh the costs significantly. For instance I have embraced closures because they shorten code and remove inter-object wiring. Also they add almost no additional syntax; great value.
Concerning Matthew, I attended his talk "Beautiful Code" at Dutch PHP Conference 2012 this summer. We seem to have different opinions about "Beautiful".
I also believe that when using an IDE, it's nice to be able to "browse" through namespaces so you can more easily select packages. I can just select a namespace and see what it contains. Underscores can't do that.
Initially I shared your opinion, I hated namespaces. But once I started working with them I started to like them. And now, I actually love the way they work. Explicitly using classes means that you always know what's being used, and what's not. And you don't end up with new Some_Extremely_Long_Class_Name();
, as you've used your classes and can now use just the classname. Sure, you could setup aliases, but that doesn't count as that's more complex and less appealing.
Using namespaces is something that brings structure as it really creates separation. Underscores just let you believe that there are namespaces.
Anyway, I'm going to stop trying to convince you now :) I've decided to go with Doctrine2.
Best of luck!
@gabordemooij Your first two points relate to aesthetics. That's a given with the php language, and imho shouldn't be a deciding factor. Also, it was thoroughly discussed on the php internals group, and well argumented: https://wiki.php.net/rfc/namespaceseparator
In general, my philosophy is to use as little language features as possible, I am a minimalist.
I would suggest writing your application in Assembly. I personally like to keep my application as maintainable as possible. Even if that means it becomes twice as big.
@Freeaqingme Minimalism is a powerful tool to keep things simple, maintainable. Assembly code is not very minimalistic I can assure you (I have written a pacman clone in x86 assembler once ;)). Smalltalk would be. I will check the PHP wiki discussion, sounds interesting.
The IDE thing IS a good argument though. I didn't think of that. Noted.
Concerning Doctrine2: Ok, well I hope you like it. Good luck.
Hi. I don't know if I should be asking this using the issue system on github, but I have no idea how to otherwise contact anyone.
I was wondering if this whole "namespaces suck" attitude is still the case. I personally believe that a lot of arguments used against them are invalid. It'd be a shame if redbeans were to stay unnamespaced (in my opinion) and I'm curious if it will.
This is in no way an attack. I'm genuinely curious.