Are the posted questions getting worse?

  • GilaMonster (4/2/2014)


    Readability is crucial

    Beautiful is better than ugly

    Simple is better than complex

    ....;-)

    That said, I can't figure out how (or if it's possible) to have another statement in the loop after the IF ends

    I couldn't agree more that readability is critical in any language and I do write so the code is pretty. My indenting is very consistent, but I still prefer explicit terminators.

  • GilaMonster (4/2/2014)

    It's better because now you don't have all those unnecessary starting and ending characters, and you'll avoid the arguments about where to place those brackets.

    😉

    Pah! Everyone knows that the only true position for braces is like this:

    if (i == 1)

    {

    // Do cool stuff

    }

    :hehe:

  • Ok......

    Guideline for python code:

    "Explicit is better than implicit"

    I can agree with that, it's something I argue for when teaching T-SQL. Be explicit.

    Then, from the style guide for python:

    Bad form:

    if attr == True:

    print 'True!'

    Good form:

    if attr:

    print 'attr is truthy!'

    Correct me if I'm wrong, but the first is more explicit than the second, right?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • paul.knibbs (4/2/2014)


    GilaMonster (4/2/2014)

    It's better because now you don't have all those unnecessary starting and ending characters, and you'll avoid the arguments about where to place those brackets.

    😉

    Pah! Everyone knows that the only true position for braces is like this:

    if (i == 1)

    {

    // Do cool stuff

    }

    :hehe:

    +1

    Couldn't agree more. 🙂

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • paul.knibbs (4/2/2014)


    GilaMonster (4/2/2014)

    It's better because now you don't have all those unnecessary starting and ending characters, and you'll avoid the arguments about where to place those brackets.

    😉

    Pah! Everyone knows that the only true position for braces is like this:

    if (i == 1) {

    // Do cool stuff

    }

    :hehe:

    Looks good to me.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (4/2/2014)


    Ok......

    Guideline for python code:

    "Explicit is better than implicit"

    I can agree with that, it's something I argue for when teaching T-SQL. Be explicit.

    Then, from the style guide for python:

    Bad form:

    if attr == True:

    print 'True!'

    Good form:

    if attr:

    print 'attr is truthy!'

    Correct me if I'm wrong, but the first is more explicit than the second, right?

    Yeah, the first one is explicit. You'd think Python has been around long enough and reviewed by enough people to where they would have caught and corrected that.

  • To concatenate values together...

    location = ''.join(['New','south','wales'])

    "This will feel natural and elegant to the initiated."

    and I thought readability was crucial.

    Edit: The snide comments are more directed to the training course than the language. The training video punctuates examples of code with slides containing a zen-style image, a haiku and some oriental music

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (4/2/2014)


    To concatenate values together...

    location = ''.join(['New','south','wales'])

    "This will feel natural and elegant to the initiated."

    and I thought readability was crucial.

    Edit: The snide comments are more directed to the training course than the language. The training video punctuates examples of code with slides containing a zen-style image, a haiku and some oriental music

    I had kind of been interested in learning Python. After hearing your rants for the last couple days and the ludicrous indentation meaning something I am running away as quickly as possible. Funny how they say explicit is better than implicit and then use indentations to mean something. Talk about implicit!!!

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • It's not the language I have an issue with. It's different, the indenting will take some getting used to, there are odd conventions about how to handle lists and other complex data structures, but that's fine.

    It's the tone of the course which has me ranting. Haiku, zen-like sayings, music, comments referring to 'the initiated' and 'uninitiated individuals', etc makes me feel like I'm watching some religious broadcast, not an introductory lesson on a computer language.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Still seems quite strange. I can almost imagine the discussions in a bug tracker. "Oh I forgot to add an empty line to end the IF statement".

    Or..."just added a tab at the beginning of the line so it was inside the loop".

    I not a fan of stuff like that at all. Just my personal preference I suppose but that seems like an invitation to write super buggy code.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • But it does enforce that everybody uses the same exact code style because the style is actually part of the syntax. No arguments over:

    if(SomeCondition){

    DoSomething();

    }

    vs.

    if(SomeCondition)

    {

    DoSomething();

    }

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • GilaMonster (4/2/2014)


    It's not the language I have an issue with. It's different, the indenting will take some getting used to, there are odd conventions about how to handle lists and other complex data structures, but that's fine.

    It's the tone of the course which has me ranting. Haiku, zen-like sayings, music, comments referring to 'the initiated' and 'uninitiated individuals', etc makes me feel like I'm watching some religious broadcast, not an introductory lesson on a computer language.

    So you are ranting, not chanting? 🙂

    Sounds like part of the training is preparing you to join a Cult.

    It's one thing to make training more interesting, another to make it seem like a brain washing session.

    Very distracting.

  • GilaMonster (4/2/2014)


    Ok......

    Guideline for python code:

    "Explicit is better than implicit"

    I can agree with that, it's something I argue for when teaching T-SQL. Be explicit.

    Then, from the style guide for python:

    Bad form:

    if attr == True:

    print 'True!'

    Good form:

    if attr:

    print 'attr is truthy!'

    Correct me if I'm wrong, but the first is more explicit than the second, right?

    I had a teacher who later became my first boss who argued that comparing a boolean value to true or false was redundant. If the if clause is evaluating a boolean value and your variable is boolean, then there's no need to compare it again. That worked fine with VFP, but not with SQL Server where we have no boolean data type, as bit is not the same thing.

    So, using: if attr:

    print 'attr is truthy!'

    Would be as explicit as using:

    IF EXISTS(SELECT 1 FROM Sometable)

    PRINT 'Some Data'

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • GilaMonster (4/2/2014)


    Ok......

    Guideline for python code:

    "Explicit is better than implicit"

    I can agree with that, it's something I argue for when teaching T-SQL. Be explicit.

    Then, from the style guide for python:

    Bad form:

    if attr == True:

    print 'True!'

    Good form:

    if attr:

    print 'attr is truthy!'

    Correct me if I'm wrong, but the first is more explicit than the second, right?

    Could it be because True is actually instance of class bool and therefore you are not testing boolean operation, but instead testing equivalence of two classes?

  • Ville-Pekka Vahteala (4/2/2014)


    Could it be because True is actually instance of class bool and therefore you are not testing boolean operation, but instead testing equivalence of two classes?

    No, the value there is a bool. I suspect in this case the requirement for elegance and beautiful code is overriding the be explicit and readability is critical.

    somevalue = True

    if somevalue == True:

    print("It really is true")

    or

    somevalue = True

    if somevalue:

    print("It really is true")

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 43,606 through 43,620 (of 66,000 total)

You must be logged in to reply to this topic. Login to reply