SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 95
  1. #51
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by XtrEM3 View Post
    so have we concluded that __autoload is not overrated?
    I think we're right where we started. Those who like __autoload will use it. Those who don't will create their own alternatives.

    Quote Originally Posted by arkinstall View Post
    Surely this... [m]akes more sense than... [i]n the english sense.
    To tell you the truth, it has been so long since I learned that stuff that I forget what the rationale is for using singular names.

  2. #52
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do other languages use autoload like C++, Java, etc..?

    I have done a search on google but nothing definite.

  3. #53
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no java requires an "import" definition in every file you call the classes in. i think if you load files from the same package you don't have to though.

  4. #54
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Regarding singular vs. plural table names, I prefer singular since it gets rid of a lot of ambiguity. When it comes to mapping or code generation, this is helpful. Is it garden or gardens? daisy or daisies? With the singular form it's obvious in both cases. Another consideration is the naming of many to many tables. Is it gardens_daisies or garden_daisies? I'd rather just call it garden_daisy and be done with it. Maybe the SQL isn't as pretty, but at least it's consistent across the board.

  5. #55
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cuberoot View Post
    Regarding singular vs. plural table names, I prefer singular since it gets rid of a lot of ambiguity. When it comes to mapping or code generation, this is helpful. Is it garden or gardens? daisy or daisies? With the singular form it's obvious in both cases. Another consideration is the naming of many to many tables. Is it gardens_daisies or garden_daisies? I'd rather just call it garden_daisy and be done with it. Maybe the SQL isn't as pretty, but at least it's consistent across the board.
    For the same reason arkinstall mentioned, I think table names should be plural. You are, after all, selecting one or more garden_daisies from a group of garden_daisies... no ambiguity there. selecting from a group of garden_daisy just doesn't make sense. Once I started using plural instead of singular, my sql queries became much more readable.

  6. #56
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Technically, each row in the table would represent a single garden daisy, so it makes perfect sense to me. That's just a matter of perspective in my opinion.

    In any case, you can definitely simplify some coding tasks if you eliminate the linguistic ambiguities that come along with plural forms. That was the main thing I was getting at.

  7. #57
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm with cuberoot on this.

  8. #58
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cuberoot View Post
    Technically, each row in the table would represent a single garden daisy, so it makes perfect sense to me.
    You're right, it does. But the table as a whole would be multiple garden daisies. So

    SELECT * FROM garden_daisies
    Makes the most sense to me.

  9. #59
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blueyon View Post
    Do other languages use autoload like C++, Java, etc..?

    I have done a search on google but nothing definite.
    Why does that matter? PHP isn't Java or C++. It has it's concepts unique to it just like C++ and Java have concepts unique to them. C++ doesn't have an __autoload feature but it has pointers and pointers to functions of type void, but that has absolutely nothing to do with PHP.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  10. #60
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blueyon View Post
    Do other languages use autoload like C++, Java, etc..
    It's called a dll

  11. #61
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    It's called a dll
    How is a DLL like __autoload o.o?
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  12. #62
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by imaginethis View Post
    How is a DLL like __autoload o.o?
    Not much really. PHP is an interpreted language, C++ is not. That makes the question kind of absurd in the first place, but the closest thing you can come to dynamically loading code, is the dynamic linking of static code libraries (dll's)

  13. #63
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still don't see how that could be considered close considering you still have to include the DLL to compile C++ source... but ok.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  14. #64
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by imaginethis View Post
    I still don't see how that could be considered close considering you still have to include the DLL to compile C++ source... but ok.
    You just need the header files .. and while my C++ is quite rusty, I think you can get away with attatching to a dll in runtime, without having the header files too. Not sure about the details.

    My point was really that it's absurd to talk about an autoload mechanism in C++ in the first place.

  15. #65
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DLLs aren't native C++ constructs anyway. They're part of Window's architecture.

  16. #66
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by World Wide Weird View Post
    DLLs aren't native C++ constructs anyway. They're part of Window's architecture.
    There aren't any C++ constructs at the time the code runs. It's compiled into machine code.

  17. #67
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol this thread is going nowhere...fast.

  18. #68
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, "SELECT id FROM daisy" makes much more sense linguistically than "SELECT id FROM daisies" -- especially if you remember that "FROM" is a shorter version of "FROM EACH", which is what it essentially stands for.

  19. #69
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    There aren't any C++ constructs at the time the code runs. It's compiled into machine code.
    If you drill down to the machine code level, discussing any features of the high-level languages under comparison becomes moot, no?

  20. #70
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by World Wide Weird View Post
    If you drill down to the machine code level, discussing any features of the high-level languages under comparison becomes moot, no?
    yes

  21. #71
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm more intreasted in how other OOP languages load files. If Java (which i think is a mature OOP language) does loading using import then i don't see why the PHP creators need to start creating new OOP features. I prefer them to follow a route of new features that has been tried and tested.

  22. #72
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP is not Java! it has it's own end goal, and its own set of features. besides, it's pretty cumbersome to have to write each import at the top of every file you wanna use the object in. it almost makes using hand-writing code impossible, and using an IDE a necessity.

    clearly this is not the route the PHP team wants to take. whether it be so it's easier to pickup for new users, or because there are restrictions that require a different approach to solve a common problem (ie. PHP is loosely typed while Java is statically typed), you cannot expect PHP to be trailing in the footsteps of java, that was never what it was intended to do.

  23. #73
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there any other language that uses underscores in class names? and aligns the class names to files.

    This type of coding from Zend framework is ridiculous:

    $var = new Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter();

    You can tell they are not coding properly because of such poor benchmarks and having to rely a lot more on caching.

    If you look at frameworks from Joomla or Code Igniter you can tell there is more intelligence behind the coding.

  24. #74
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blueyon View Post
    Do other languages use autoload like C++, Java, etc..?

    I have done a search on google but nothing definite.
    Java is smart enough to know where to find the class. Java, like many languages, use packages so everything is much more organized and standard.

    PHP doesn't have packages. It doesn't know where to find the source file of a particular class, so you have to write your own autoloader function. This, of course, doesn't breed a standard convention among PHP developers.

    However, PHP does have namespaces now. If XtrEM3 is complaining about Java's import statements, he has much more to complain with PHP's namespaces. In Java, because it's a package-oriented system, you can import an entire namespace (i.e. import com.example.db.*). In PHP, if you want to use namespaces, you have to explicitly define every class you want to use with a use statement if you want to use autoload, so you have to write even more with PHP.

    The reason Zend uses class names like that is because it's emulating namespaces. Namespaces are available as of PHP 5.3.0, but PHP 5.3.0 has not been released yet, and it may take some time for web hosts to adopt it.

    Edit:

    How Java handles autoload on its own, for those who aren't familiar with Java: http://java.sun.com/j2se/1.3/docs/to...html#userclass

  25. #75
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blueyon View Post
    Is there any other language that uses underscores in class names? and aligns the class names to files.
    Why yes other languages can use underscores as class/object names. The convention you are talking about has to do with ZEND not with PHP! Zend chose to use underscores and align to files it is not forced upon by PHP. Come on it cannot be that hard to understand.

    If you don't like underscores in your class names then don't use them, I know that I don't. All my classes for my framework (PHP 5.2 version) are "lfDatabaseMysql" camelcase the "lf" prefix is for pre-namespace.

    You can tell they are not coding properly because of such poor benchmarks and having to rely a lot more on caching.
    Uhhh....what?! Because of the class name Zend must be not coding properly? That makes no sense.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •