Is there any reason to not prefix all uses of standard php classes with "\" for future namespace purposes?
Search found 16 matches
- Sat Jun 11, 2016 1:12 pm
- Forum: PHP - Theory and Design
- Topic: Prefix all use of standard php classes with \ ?
- Replies: 12
- Views: 49400
Re: Prefix all use of standard php classes with \ ?
- Sat Jun 11, 2016 12:59 am
- Forum: PHP - Theory and Design
- Topic: Prefix all use of standard php classes with \ ?
- Replies: 12
- Views: 49400
Re: Prefix all use of standard php classes with \ ?
I can't see how not using the root namespace sign “\” inside the root namespace can introduce name collisions and confusion, except if someone is using PHP namespaces in ways that are not introduced for and I can't imagine right now. Lets say you have a class StringUtils in the root and then there i...
- Sun Jun 05, 2016 7:59 pm
- Forum: PHP - Theory and Design
- Topic: Prefix all use of standard php classes with \ ?
- Replies: 12
- Views: 49400
Re: Prefix all use of standard php classes with \ ?
Namespaces in PHP is one of the most misunderstand and misused feature. There are many reasons behind that , but it has a meaning if you are going to use namespaces at all first understand why are there , how do they really work , from the PHP manual first. Then if you really understand those you wi...
- Sun Mar 27, 2016 3:39 pm
- Forum: General Discussion
- Topic: Mentors for the ones that want to be mentored...
- Replies: 1
- Views: 4959
Re: Mentors for the ones that want to be mentored...
Do you know many PHP “programmers” that need mentors ?
- Sun Mar 27, 2016 3:18 pm
- Forum: PHP - Theory and Design
- Topic: Several basic questions about OOP in PHP
- Replies: 4
- Views: 26143
Re: Several basic questions about OOP in PHP
Its common in programming to use one thing were it hasn't nothing to do with only because you think it makes your life easier in another field. Use each aspect in each own domain. PHP didn't introduced namespaces in order for that kind of use in autoloader. In fact using namespaces only for that pur...
- Thu Mar 24, 2016 8:32 am
- Forum: PHP - Theory and Design
- Topic: Several basic questions about OOP in PHP
- Replies: 4
- Views: 26143
Re: Several basic questions about OOP in PHP
You don't have any reason to create namespaces in a deeper level except if that level is mandatory and can be alternated (even in this case it could be a namespace by its own). Don't forget that inside the same namespace you don't have to (and actually you shouldn't) use the “use” clause for classes...
- Sun Sep 06, 2015 4:29 am
- Forum: PHP - Theory and Design
- Topic: Catching an exception in MVC type structure.
- Replies: 13
- Views: 53492
Re: Catching an exception in MVC type structure.
From the 3 aspects that you described ( 1. Class page 2. 'Controller' page 3. index page) I can't understand what is the “top” . Generally , exceptions should be cached through the top level component of an application. By top I mean the one that is in the core of the app and generates all the other...
- Tue Jul 28, 2015 3:36 pm
- Forum: PHP - Theory and Design
- Topic: PHP OOP and callback from usort
- Replies: 5
- Views: 31425
Re: PHP OOP and callback from usort
I agree with you ,of course, that PHP wasn't designed as an OOP language, so in its core has mixed functional and procedural programming. For example is PDO in the core of PHP those days ? Is PDO OOP ? String manipulation as you mentioned is still a thing but I can't remember when I needed a string ...
- Fri Jul 24, 2015 12:15 pm
- Forum: PHP - Theory and Design
- Topic: PHP OOP and callback from usort
- Replies: 5
- Views: 31425
Re: PHP OOP and callback from usort
PHP is not “primary procedural” PHP is a multi paradigm language , that most write PHP in primary procedural way even if they use classes is a fact , but this has nothing to do with the language itself. I am writing strictly OOP PHP many years now. As requinix mentioned use type hinting not evaluati...
- Wed Apr 08, 2015 4:37 am
- Forum: PHP - Theory and Design
- Topic: PHP traits , is there really a reason for that ?
- Replies: 2
- Views: 16735
PHP traits , is there really a reason for that ?
I seriously dislike PHP traits ... I can find any other use of it other than “I don't want to write OOP but I pretend I do” am I wrong , is there any real use of it ?
- Wed Apr 08, 2015 4:29 am
- Forum: PHP - Theory and Design
- Topic: Use class properties or pass data around as method arguments
- Replies: 7
- Views: 23578
Re: Use class properties or pass data around as method argum
<Christopher> "PS - I'd recommend protected over private, unless you absolutely know that you want to forbid a child class from accessing a property.: I agree with this adding “directly” after the end of the sentence. Remember bicycle :) for example gear is something that all bicycles have, but...
- Wed Feb 05, 2014 8:21 am
- Forum: PHP - Theory and Design
- Topic: when would be a time to realize I am too stupid to learn php
- Replies: 13
- Views: 21355
Re: when would be a time to realize I am too stupid to learn
Really you are troubling about it so you probably this is not the case , but lets be fare not all people can be real programmers. There are many people that can’t really go along with programming. Some of them might have PhD’s in programming but they can’t really understand what we are doing. The ma...
- Wed Feb 05, 2014 7:59 am
- Forum: PHP - Theory and Design
- Topic: naming of field convention
- Replies: 4
- Views: 9131
Re: naming of field convention
The address is more complicated to talk about, it is an object in real life (it has postal code , street name , country …. And more ) in OOP and should be a row in a table in a db and then use that id in other tables , eg the supplier table should have an address_id on it , meaning the id of the row...
- Wed Feb 05, 2014 7:43 am
- Forum: PHP - Theory and Design
- Topic: Uses for interfaces?
- Replies: 9
- Views: 13562
Re: Uses for interfaces?
Even if you are programming alone and you do all the jobs never think it this way. Think it like you was in a team and you were designing something. Interfaces are something great to put some ground and common rules. For example a vehicle should have gear and a method to set – get them, logical shou...
- Tue Feb 23, 2010 12:55 pm
- Forum: PHP - Code
- Topic: Single Sign on Implementation in php mysql
- Replies: 1
- Views: 312
Re: Single Sign on Implementation in php mysql
Hello,
Do you have multiple related but indepented software systems or web applications in your site , or you just want to keep the user status if has login ?
Do you have multiple related but indepented software systems or web applications in your site , or you just want to keep the user status if has login ?