Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorMark
    • CommentTimeFeb 16th 2008
     # 1
    Hello Everyone!

    I've finally left the drawing board for Vanilla 2 and started doing some programming tests to see if many of my ideas will pan out or not.

    Since I'm basically starting from scratch, I've got some pretty basic questions that need answering. One of them is about naming conventions. I've written a blog entry about it and I'd love it if you guys took a look and shared your thoughts:

    http://markosullivan.ca/blog/?p=43
    • CommentAuthorPTVDesign
    • CommentTimeFeb 16th 2008
     # 2
    $variable_name = '';

    function function_name($variable_name) {}

    class class_name {
    method_name($variable_name) {}
    }

    IMHO: don't use uppercase
    •  
      CommentAuthory2kbg
    • CommentTimeFeb 16th 2008
     # 3
    vanilla 2 =) total sweetness

    i second the above suggestion because if caps give problem avoid it, otherwise i like you original

    VariableName
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 17th 2008
     # 4
    When I started programming PHP I always used stuff_like_this(); because that's what all my examples used. Since I've started writing extensions for Vanilla I've started following the conventions that you used. I don't know why but I think it makes my code look nicer and more readable - it feels less hacky.

    If anything I would vote to stay with the same conventions you've got. I much prefer it. It also helps to separate core PHP functions from user-defined ones.

    It also allows scope to make underscores more important (e.g. for prefixing extension functions to avoid namespace clashes).

    I would also recommend reading about Hungarian Notation. It looks a bit like camelCase, which I hate but it could also be combined with your current notation and an underscore for some extra clarity: i.e. $uv_Name = ForceIncomingString('Name', ''); Would refer to an unsafe, unvalidated form string.
    •  
      CommentAuthorMark
    • CommentTimeFeb 17th 2008 edited
     # 5
    Hmmm. Interesting - I didn't expect that anyone would want me to keep my naming the same :)

    I was thinking about how I could accomplish my task and keep my naming the same last night, and I think it might be do-able.

    I'd still like to hear what more people think, though.
    •  
      CommentAuthorMax_B
    • CommentTimeFeb 17th 2008
     # 6
    I don't like camelCase, at all. I always though that underscore is more readable.
    The initial capital for Class seems a good convention to me.

    Exactly what you suggested in your blog in fact.
    •  
      CommentAuthorbobthecow
    • CommentTimeFeb 18th 2008
     # 7
    hungarian notation is the devil, imho. my vote is with ptvdesign's suggestion. if you feel you must use uppercase, use it for class names.
    •  
      CommentAuthormattucf
    • CommentTimeFeb 18th 2008
     # 8
    I think naming conventions steal too much focus. It doesn't matter which convention you use, just that you have one.

    There's a difference between readability and comfort, and I think when many people mention the former, they mean the latter.
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 18th 2008
     # 9
    Uh... can we have some justifications for these points please? Why do you think Hungarian Notation is 'the devil' and what type of Hunagarian Notation, there are two.

    Underscores take more keystrokes and make the variable name longer which is why I now prefer the Vanilla convention. I'd also prefer to capitalise the first name of every variable rather than just class names because it avoids camelCase.
    • CommentAuthortimfire
    • CommentTimeFeb 18th 2008
     # 10
    Might I also suggest explicit conventions for extensions? I think it would be nice if functions and classes in extensions included the name of the extension, such as:

    ExtensionName_FunctionName() {}

    ExtensionName_ClassName {}

    I don't know if there's ever been any clashes between extensions using functions/classes with the same name before, but requiring something like the above should prevent any clashes in the future.

    Including the extension name in the variable name would be nice for important variables, but probably isn't necessary for all.
    •  
      CommentAuthorrel1sh
    • CommentTimeFeb 19th 2008
     # 11
    The first naming convention I was ever formally taught (and required to adhere to) was Camel Case: start variables, methods, and arguments with lower case; start class names with an upper case to denote their importance. I had no problem with it then and have no problem with it now. I think it generally aids reading of code and keeps it more "compact" on each line, as well as encouraging more meaningful variable name usage. The fact that it reminds me of programming in Java, however, is a slightly more sore subject.

    Regardless, I definitely agree with timfire up above about leaning on extension authors to prevent the inevitable method or class name collision. Really, unless you have some technical hurdle which will prevent upper case characters in variable/method names, I'd say keep it as-is. The effort to convert at this point seems borderline obsessive.
    •  
      CommentAuthorMark
    • CommentTimeFeb 19th 2008
     # 12
    The effort to convert at this point seems borderline obsessive.

    There's nothing to convert. I'm starting from scratch.
    • CommentAuthorawpti
    • CommentTimeFeb 19th 2008 edited
     # 13
    I started with the camelcase methodology when I was a "young developer" (back in '98). Over time, I've found it's harder to maintain (read).

    I've only recently switched from camelCase to using_underscores.

    I find this;

    $my_var = specific_function($var_foo);

    is easier to read than;

    $myVar = specificFunction($varFoo)

    The advantage of staying away from camelcase is the VISIBLE seperation of words. You get to keep your semi-descriptive function naming while gaining readability and hence, maintainability.

    I like this document;

    http://expressionengine.com/docs/development/guidelines/general.html

    While it's specific to EE Addon Dev, it can be applied (and makes perfect sense) everywhere (I don't like EE myself, but the developers are fantastic).

    Also, consider making use of a Framework, such as Kohana (Fork of CodeIgniter, completely re-written and PHP5 strict). As an aside, consider the gophp5 movement. It's time for PHP4 to die a horrible, flaming death.

    (As an aside, I agree with a poster above - methodology is about comfort - but also still covers readability as much as it does comfort).
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 19th 2008
     # 14
    I think the reason for PHP 4 is that many hosts still don't offer PHP 5 support and so using PHP 5 would prevent a large group of people unable to use Vanilla on their sites.

    Rewriting Vanilla opens the possibility for having a PHP 5 version of Vanilla 2 and leaving Vanilla 1 for the PHP 4 users.

    As for frameworks, I don't really think that's a good idea. It adds a lot of code overhead that is a problem for things like forums which require fast page loads. Also, as projects get bigger, frameworks become more of a hindrance than a help - you find yourself bending your code around the framework to perform otherwise simpler tasks.

    Writing a framework for Vanilla from the ground up seems like a better idea as it allows all the code to be relevant and optimised to the tasks that Vanilla needs to perform. It does increase development time but I don't think that's a big issue here
    • CommentAuthorawpti
    • CommentTimeFeb 19th 2008
     # 15
    I have, personally, not run into any need to 'bend' my methods to the whims of a framework (I use Kohana). It's flexibile and minimalist enough to let me do what I want while giving me a base of features that I don't feel like re-developing.

    As far as PHP4/PHP5 goes, there is absolutely no excuse for any host these days to not offer PHP5. People who use those hosts need to switch off to another host that has made a modicum of effort to move forward and support PHP5.

    V1 and V2 is a perfect time to split away from PHP4.

    Still running PHP4? Vanilla for you.
    Running PHP5? Vanilla 2 for you!

    The other side of the whole framework thing is just being able to yank the bits and pieces that you like right out of it. In simple apps where a framework would be bloated, I've managed to yoink some nice functionality away from CI/Kohana without breaking it.

    A framework would not be a bad idea for a project like this. Kohana is an example of a minimalist framework (unlike Cake or Symfony, et al). It has a core set of features. You build it up from there. If you get a chance, read up on it for the hell of it.

    I was against Framework for a LONG time until I ran across CodeIgniter and decided to give it a go. Used it for 6 months before shifting over to Kohana. It has easily halved the average time to go from an idea to functional code.

    In any case, just some potential suggestions. I don't know if Mark is going to be doing this as a public work with a group of core developers or himself. Hopefully the former, but if the latter, it's good to know he's taking suggestions and looking at available options.

    (Sorry for shifting slightly off-topic, but it doesn't to add input elsewhere)
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 19th 2008
     # 16
    Valid points, I've never used those frameworks before (I thought Symphony was a CMS, not a framework though) so I'm perfectly happy to believe what you're saying. I don't know for how large of a project you've used Kohana but in my experience frameworks are great for smaller projects, it's when you build bigger that they tend to get in the way. I don't think that has to be the case for all frameworks though so the possibility of a framework for Vanilla 2 shouldn't be ruled out.
    • CommentAuthorawpti
    • CommentTimeFeb 19th 2008
     # 17
    In the end, this is obviously up to Mark.

    Would love to get his input on the overall discussion so far!
    •  
      CommentAuthorWallPhone
    • CommentTimeFeb 19th 2008
     # 18
    My host (1and1) is 4.4.7, but can do PHP5 with a .htaccess directive

    I'm all for Vanilla 2 being PHP5, and will even help support Vanilla 1.x in PHP4 land.
  1.  # 19
    Mark already has made the decision NOT to use php5. he made that clear on his blog post.

    as far as frameworks are concerned, making a new one for vanilla2 means we don't see vanilla untill next year.
    using frameworks gives us vanilla2 in matter of months.

    Don't want V2 to use full frameworks like (cake, codeignitor, kohana etc)
    prefer glue frameworks like Zend so there is NO overhead, use just the stuff you need. not to mention using Zend will give vanilla lot of eye balls and free promotion from zend itself. Zend supports tons of webservices, which means Vanilla can leverage them in a snap., flickr, google maps, amazon, delicious yahoo etc. these are real benefits for V2 users

    last Why reinvent the wheel, mark should spend time making cool features and implementing new ideas NOT making a new framework.
  2.  # 20
    MSB - "I’m pretty excited about where this is going and I think I’m going to continue on with PHP 5 to see where it takes me.".....that seems to me he IS using PHP5?
    •  
      CommentAuthorDinoboff
    • CommentTimeFeb 20th 2008
     # 21
    @MySchizoBuddy:

    Check the good news: http://markosullivan.ca/blog/?p=44.

    About the framework. I would be happy if Mark were using Zend Framework 1.5 (Zend_Layout and the new partial helpers of Zend_View offer everything we need for vanilla); but Mark can use it's own MVC and DB framework, we can use any Zend component for our extensions.
    •  
      CommentAuthorsquirrel
    • CommentTimeFeb 20th 2008
     # 22
    Agree with mattucf. Just pick one and stick to it. That will put you ahead of PHP's own schizophrenic blend of C-style and perl-style naming.
  3.  # 23
    this would be a good time to create some demo themes for vanilla 2. one less work for mark
    i like the theme of beast forum engine http://beast.caboo.se/

    no i'm not saying to copy it. but something as simple as beast
    •  
      CommentAuthorklip
    • CommentTimeFeb 22nd 2008
     # 24
    I like the convention as it is. But if you have to adjust lot of different codes you got used to everything, so I personally don't care.

    I like timfire's suggestion to have extension's name as a prefix for extensions identifiers.

    I think any framework is better than nothing.

    PHP4 vs. PHP5: I guess when the day comes and Vanilla 2 is ready and stable, PHP5 would be much much more supported then now.
    There is no reason for hosting companies to not support PHP5 but lazyness. Shame on them!

    http://www.php.net/ sais:
    PHP 4 end of life announcement
    [13-Jul-2007]

    Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

    The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.
    What else to say?
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 22nd 2008
     # 25
    I think any framework is better than nothing.
    Why?
  4.  # 26
    @Dinoboff
    *smacks myself*
    whats stopping us from using zend anyway. i like the new Zend_Form, i hate creating forms for extensions. such a tedious work.
    http://devzone.zend.com/article/3030-Lifting-the-Skirt-on-Zend-Framework-1.5---Zend_Form
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 22nd 2008
     # 27
    i hate creating forms for extensions. such a tedious work.
    I'd like to second that, writing the configuration forms usually take longer than the actual functionality in my experience.
    •  
      CommentAuthorklip
    • CommentTimeFeb 22nd 2008
     # 28
    @Fyorl: because frameworks make things faster to make and still it's easier to understand the code.
    True is that to learn a framework you have to pass some learning curve, but after that everything is so fast ane easy to do.
    Actually I don't see any reason not to use a framework.

    that's my opinion :)
    •  
      CommentAuthorFyorl
    • CommentTimeFeb 22nd 2008
     # 29
    There are plenty of reasons to not use frameworks. To quote myself earlier:
    It adds a lot of code overhead that is a problem for things like forums which require fast page loads. Also, as projects get bigger, frameworks become more of a hindrance than a help - you find yourself bending your code around the framework to perform otherwise simpler tasks.
    • CommentAuthorgerry22
    • CommentTimeFeb 22nd 2008
     # 30
    I vote for Zend Framework.

    And as far as naming conventions goes, i vote camelCase.
    • CommentAuthortimfire
    • CommentTimeFeb 22nd 2008 edited
     # 31
    Re: Using a Framework

    I have no strong opinion right now, but wasn't one of Mark's goals for V2 to shrink the core program? It seems that cutting out the framework would further that goal...

    PS---I do like ThisTypeOfNamingConvention, now that I gotten used to it. It saves a few keystrokes over writing_with_underscores. But it's not a big deal. I am ambivalent towards camelCase. Pick one and go for it.
    • CommentAuthorsirlancelot
    • CommentTimeFeb 22nd 2008 edited
     # 32
    Whatever is chosen, it's less important that there be one and more so that there only be one. I loved the Lussumo Framework because there was only one naming convention (to my knowledge).

    I don't remember if the naming convention was stated in the documentation but that would also be equally as important as having only one. Naming conventions should not be an obstacle for veteran programmers, but an aid to programmers new to a team.

    Keep the current naming scheme. PHP5 is now case-sensitive when retrieving function/class/method names via get_class() or other related functions. PHP4 is no longer supported (or will no longer be soon).

    I for one however, still need to upgrade my servers to PHP5 :-/ The reason I haven't is because so far I've had no reason to upgrade... Vanilla 2 will hopefully change my mindset :) hopefully soon too!
Add your comments
    Username Password
  • Format comments as