Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Rewrite in order.

edited January 2006 in Vanilla 1.0 Help
This sounds strange but,

The vanilla code is crap.

Because:
  1. LongFunctionClassAndVaribleNamesAreBadChangeThem
  2. useCamelCaseInVariblesNot LikeThis but likeThis
  3. NEVER use " apart from \n. it slows down the parser. use '. and if you need to add a varible use like 'Hello, ' . $world . ' today!'. for newlines do like 'Hi there!' . "\n" - that's the only time you should use "
This would make vanilla fast and brilliant even more. Vanilla 3? I sure know I'll help code it.
«1

Comments

  • Options
    1. They're descriptive and don't take that long to type 2. In function and variable names, yes. In class names, no. 3. String manipulation code in general does need to be cleaned up a bit, but I don't know if it's really a priority.
  • Options
    Use <ol> and >li> tags for lists.
    1. It's common practice - it's bloat.
    2. Why not?
    3. It really is a big increase in speed.
  • Options
    NickENickE New
    edited January 2006
    What about Hungarian Notation? But yeah, I've always found it a little silly when people obsess (sp?) over the format of function and variable names. I mean, if they tell you what they do, and they're not too cumbersome, what really is the big deal about things like gettimeofday() versus GetSystemTime()?
  • Options
    edited January 2006
    SirNot: I'm going to pretend you didn't just say that.
    It's common practice - it's bloat.
    It's a few extra bytes, in exchange for more readable code.
    Why not?
    Standard PHP naming conventions use camel case for variables and functions, and title case for classes and interfaces.
  • Options
    Copying php is a bad idea, they switch between stucktogether, under_score and camelCase.
  • Options
    >SirNot: I'm going to pretend you didn't just say that. What part? The former was a joke, before you go off thinking I was really suggesting that.
  • Options
    where's that quote extension when you need it lol.
  • Options
    MarkMark Vanilla Staff
    This sounds strange but,

    The vanilla code is crap.


    Thank you!

    LongFunctionClassAndVaribleNamesAreBadChangeThem

    I coded it the way I like it. In my mind, a little bloat in exchange for clarity is a fair trade.

    useCamelCaseInVariblesNot LikeThis but likeThis

    This is just a personal preference.

    NEVER use " apart from \n. it slows down the parser. use '. and if you need to add a varible use like 'Hello, ' . $world . ' today!'. for newlines do like 'Hi there!' . "\n" - that's the only time you should use "

    I don't know if there is any truth to this, but I will certainly do some tests and find out.
  • Options
    I think single quoted strings are not escaped, which would speed them up some. Whether that's a large enough performance gain to warrant the effort (when there is lots of other things that need to be done) was my question.
  • Options
    Yes, escapes and interpolation is turned off for single quoted strings.
  • Options
    Yes. Even PHP.net says that.
  • Options
    josjos
    edited January 2006
    Whatever the truth about this, some things can be said less rude. I too wish
    NEVER use " apart from \n. it slows down the parser. use '. and if you need to add a varible use like 'Hello, ' . $world . ' today!'. for newlines do like 'Hi there!' . "\n" - that's the only time you should use "
    was written more clearly so I could have read it faster, but that doesn't mean I have to say it's crap.
  • Options
    thats where you're wrong, jos. Being an arse gets you everywhere. </sarcasm>
  • Options
    MarkMark Vanilla Staff
    For the record, I went through the entire framework, people, vanilla, and swell and changed all templates and just about every single class file and function to use single quotes instead of double. We might see a few bugs crop up over the next few days.

    Also for the record, I noticed a speed increase of appx 0.01 seconds. Not much, but whatever.
  • Options
    Well it does get you the benefit of not having to escape double quotes...
  • Options
    lechlech Chicagoland
    indeed, now you need to only escape single quotes :D this might make a few extensions go belly up if they contain source in double quotes. I expect that's where many of the issues will stem from.
  • Options
    NEVER use " apart from \n. it slows down the parser. use '. and if you need to add a varible use like 'Hello, ' . $world . ' today!'. for newlines do like 'Hi there!' . "\n" - that's the only time you should use "

    I don't know if there is any truth to this, but I will certainly do some tests and find out.
    Indeed. Why escape double quotes for variables? It doesn't help enough with readability to make a difference since most syntax-highlighters will highlight the variable differently than the string itself.

    Also, it's less work for you. Escaping variables/quotes/etc takes longer and makes things look plain ugly.
  • Options
    A caption from actual military subcontractor "COL" book back in the day. "We presented the gun for a board of hard ass generals in a big room. They accepted it well, but one that just HAD to say something was a spacing fool, must have been on acid or something. General: "I like the weapon, looks a real killer" Engineer: "Thank you sir, I appreciate" General: "But to be honest, I don't really like the black in this gun" Engineer: "Ok? Well have the production line work that out for you then" General: "I think if you replace the barrel and redesign the handle it will be fine" Engineer: "The color you mean?" General: "Yes son, now get cracking" So we ended up replacing the barrel and making a complete redesign on the handle (which by the way made us redesign 90% of the mechanics inside) to make the black color fit for the General Hard Ass. Strange huh? Well, that was the 60s"
  • Options
    1: Use code-completion. Though some of the functions are bad yeah. Personally I don't like all the code required to create a new object. Perhaps you should make a macro mark?

    2: Classes should not have their first char uppercase because they're not variables. For languages that don't use a symbol to indicate variables that's very important for readability. ([[MyWindow alloc] init] vs [window titleName: @Title] for Cocoa for example) For PHP it's not that imporant, but it's generally still a good idea. I agree on camelCase for functions and variables though.

    3: It's not that much difference. Remember that PHP code is never compiled anyway (unless you use an optimizer). I use single quotes personally because webcode contain a lot of double quotes. But then again I like to use templates with placeholders ([[pageTitle]] for example)
  • Options
    Classes should not have their first char uppercase because they're not variables
    Um, that's exactly *why* they should have different formatting

    variableName
    functionName
    ClassName
This discussion has been closed.