Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 3 of 3 FirstFirst 123
Results 31 to 44 of 44
  1. #31
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I also happen to find style important...I use K&R braces, I use single quotes for anything that doesn't need to have double quootes, I enjoy well-formatted code which is why indents are built into my PHP, HTML, and HTML in PHP (such as echoes), but everyone has their style. Some use different brace types, some put spaces between a function's parenthesis and any passed variables. Nobody's style is the best, though in my opinion I'd have to say the one that promotes code-readability is the best.

    This snippit of code I wrote before I even knew basename(), pathinfo(), and other such functions existed, and had I known I wouldn't have even posted this snippit, however I do find it important that programmers learn how to solve problems creatively and not just rely on functions served to them. I was working on a project that required me to parse paths and get the name of the file and extension, thus I wrote this code. I suppose it could be a lesson...there's always another way to something.
    Last edited by Velox Letum; 12-15-2005 at 04:55 AM.
    "$question = ( to() ) ? be() : ~be();"

  2. #32
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I see that I have succesfully started pretty big argument by using difficult words like "style" or "guideline"...

    I just might add that you can "sense" the writers personality when you look at how he writes things. You can see if that person knows what and to whom he is writing to. Depending on the reciever the same meaning should be convaeyd in different ways. When I see someones code (though it can be normal writing aswell) I can see if the person is lazy or if he wrote it in a hurry (and some other thigns too). Make conclusions as you like.

    For example, up until 6 months ago, I didnt know you could do:
    $object->function()->somethingElse()->SomethingElse;
    Becuase I was told once that it was not possible, I never questioned it. I only questioned it when I saw it in a script, and found out it was possible and I had been misguided. Since then, I have done my best to ensure that misguiding information is not given out becuase it can potentially hold back someones progression. If someone comes here and gets the impression that formatting for readability is neccesary and is part of a PHP file format then they have been misguided, which is what I am trying to prevent.
    I might clean that someones record. Dircet access to a method of an object returned by a function is possible from PHP5 and up. In PHP4 you would have to assign the returned object to a variabale.

    BTW reading what you wrote is a good idea.
    When you talk to someone you talk to them.
    I still wonder what that sentance means/does.
    Last edited by marek_mar; 12-15-2005 at 02:06 PM.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  3. #33
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by Element
    Just as Error 404 said "guidelines/standards/whatever-you-want-to-call-it"
    As my last post was trying to point out, all 3 of the examples follow the same syntax (if, bracket, if statement, bracket, curved bracket, echo, curved bracket), yet they do not follow the same guidelines.

    Syntax and guidelines are two very different things.

    If you break the Syntax, the code will die horribly. If you break the guidelines, it'll work fine.

  4. #34
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Okay, you guys are purposely starting up a conversation which has been over for a day now. And indeed, I know what syntax is, which is why I can use my descriptor on syntax all I want, you can't tell me otherwise. The way a format my syntax just means the way its styled. Though I never put 'guidelines' down since I'm often coding alone because my friends are the type that slack and won't even help me... even if they offer the help.

    And despite what you all say anyone I talk to on messenger, they know exactly what I mean and even say syntax is the code, therefor what I say is perfectly fine. All you guys are doing is contradicting, this isn't even an argument. It has no valid or usefull point, and thus your simply telling me no to give me a bad time becaus you can't deal with the fact I can easily use "format my syntax/coding/programing/writing"
    Last edited by Element; 12-15-2005 at 07:00 PM.

  5. #35
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    No, we're trying to point out syntax and coding styling are two very different things.

    PHP Code:
    <?php 

    // Example 1 
    if ($num == 0) { echo 'Bob'; } 

    // Example 2 
    if ($num == 0) { 
    echo 
    'Bob'


    // Example 3 
    if ($num == 0

        echo 
    'Bob'


    ?>
    These all follow the same syntax.
    These all follow different coding styles.

  6. #36
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Error 404
    No, we're trying to point out syntax and coding styling are two very different things.

    PHP Code:
    <?php 

    // Example 1 
    if ($num == 0) { echo 'Bob'; } 

    // Example 2 
    if ($num == 0) { 
    echo 
    'Bob'


    // Example 3 
    if ($num == 0

        echo 
    'Bob'


    ?>
    These all follow the same syntax.
    These all follow different coding styles.
    Yes I understand that, but your not thinking of it correctly. Same syntax, different format. Thus, different formatting of the same syntax. I'm not saying when I format the syntax the syntax is changed, its just formatted differently just like you showed.

  7. #37
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Element
    Yes I understand that, but your not thinking of it correctly. Same syntax, different format. Thus, different formatting of the same syntax. I'm not saying when I format the syntax the syntax is changed, its just formatted differently just like you showed.
    I dont believe I am having to come back here again, but if you read ralph l mayo's post, he describes is best in my opinion, and Element, all those are the same format... Please, just give it a rest and accept that you are wrong when we are talking about the meaning of formatting in the usual context. If it makes sense to you then so be it, but please stop arguing your case.

  8. #38
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by missing-score
    I dont believe I am having to come back here again, but if you read ralph l mayo's post, he describes is best in my opinion, and Element, all those are the same format... Please, just give it a rest and accept that you are wrong when we are talking about the meaning of formatting in the usual context. If it makes sense to you then so be it, but please stop arguing your case.
    Leave it up to the Europians to be as arrogant as they can. Usual contect? Serious, grab a dictionary, thats the usual context, period. Format the same? Pshaw, right.

    2 format

    determine the arrangement of (data) for storage and display (in computer science)
    One of the many uses of the word format, even in computer science. I'm tired of you guys making it sound like I'm wrong when you have no grounds what-so-ever considering I'm using the word correctly as a descriptor for the storage and display of my code.

    If you need to read up on other uses of the word format check out: http://www.wordreference.com/definition/format

  9. #39
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    "I format my code so it will fit my coding style."
    "I have to change my coding style to fulfill the coding guidelines of my project."
    How about that?
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  10. #40
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by marek_mar
    "I format my code so it will fit my coding style."
    "I have to change my coding style to fulfill the coding guidelines of my project."
    How about that?
    Mmm its like chocolate covered strawberries....

  11. #41
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    the organization of information according to preset specifications (usually for computer processing)
    Which was my whole argument with you in the first place... That tabs and indents have nothing to do with PHP file formatting... That was what I was intending to point out initially and I have already said I didnt want to spring a whole argument from it.

    I'm going to ignore the whole europeans remark too.

  12. #42
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by missing-score
    Code:
    the organization of information according to preset specifications (usually for computer processing)
    Which was my whole argument with you in the first place... That tabs and indents have nothing to do with PHP file formatting... That was what I was intending to point out initially and I have already said I didnt want to spring a whole argument from it.

    I'm going to ignore the whole europeans remark too.
    Yes, but you see, thats for format once again. The argument was about me using format. Either way the basic meanings of format is the aspect and visual aspects of something. Either or are correct, it is a word that can be used in so many different ways.

    Like the styling of the code is a title for how each individual formats their code.

  13. #43
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Element
    Yes, but you see, thats for format once again. The argument was about me using format. Either way the basic meanings of format is the aspect and visual aspects of something. Either or are correct, it is a word that can be used in so many different ways.

    Like the styling of the code is a title for how each individual formats their code.
    Yes... I understand what you are saying, as I always have. I was trying to point out that a newline and indent have nothing to do withPHP FILE FORMAT. If you are talking obout the visual format in which PHP is seen, then you are right, which I never disputed.
    Last edited by missing-score; 12-16-2005 at 02:01 AM. Reason: Fixed Grammar

  14. #44
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by missing-score
    Yes... I understand what you are saying, as I always have. I was trying to point out that a newline and indent have PHP FILE FORMAT. If you are talking obout the visual format in which PHP is seen, then you are right, which I never disputed.
    *Gets blown into his closet* I know, it wasn't really you that did, but other people just excused what I was saying without even understanding it.


 
Page 3 of 3 FirstFirst 123

Posting Permissions

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