Ready for Readable Code? - John Papa

Поділитися
Вставка

КОМЕНТАРІ • 55

  • @tender.branson
    @tender.branson 6 років тому +140

    That bald man from Brazzers, he knows so much!

  • @herbertpimentel
    @herbertpimentel 5 років тому +3

    this guy always rock on his presentations

  • @gabrielmayta2297
    @gabrielmayta2297 5 років тому

    Great performance, make readable code is the best practice that every developer should follow. Keep calm and code!

  • @jonaskoelker
    @jonaskoelker 3 роки тому +1

    > 8:15 whatever the guideline in your company is, it help you read through the code faster.
    No method may be shorter than 200 lines.
    Every method should take at least 15 parameters.
    Variable names should use aLtErNaTiNg CaPs.
    Not.
    Obviously if guideline X makes the code more readable, the guideline "avoid X at all costs" makes the code less readable (if followed). So the guidelines don't make the code more readable no matter what they are. They have to say specific good things in order to make the code better. Duh. But why is he saying that in effect the contents don't matter?
    In some areas, consistency increases readability all by itself. If you always get food after you hear a bell ring, the world is predictable. If a method does a network call if and only if its name starts with "fetch", the code is predictable. But making your methods consistently longer than 100 lines but shorter than 200 doesn't really accomplish anything useful on its own; knowing how far there is between the opening and closing curly brackets doesn't tell you anything about the stuff between them.
    My favorite degenerate trick is to turn an n-line function into one (n-1)-line function and one two-line function which calls the (n-1)-line function. Apply it enough times and all your functions can be two-liners. Heck, if you have left-to-right argument evaluation order, you can wrap the first line in a lambda and pass it as an argument (say, in the last position) to the next function, and pass the return value of these lambdas as the first argument when you go down the chain. That way, each old line gets executed in the right order, and every function is a one-liner. Obviously this is ludicrous. Longer functions would clearly be better than this nonsense. So there's an upward pressure on method length when you optimize for readability. [There's also a downward pressure. If you know the line length at which the pressures balance out, on average, across all the code I will write in the future, I want to know how you know.]

  • @abhijeet1abhijeet
    @abhijeet1abhijeet 6 років тому +1

    I use your repositories all the time. Thank you !

  • @FallingReign
    @FallingReign 6 років тому +1

    Resources:
    Style Guide - jpapa.me/ng-guide
    VS Code - aka.ms/codeit
    Angular Essentials - aka.ms/ng-essentials
    Winter Theme - aka.ms/jp-winter

  • @andrebraga1578
    @andrebraga1578 6 років тому

    Great talk John Papa and i must say that i totally agree with all.

  • @k1zmt
    @k1zmt 6 років тому

    Great talk for newbies. John covered majority of well-known truths.

  • @mikebell2819
    @mikebell2819 6 років тому +1

    Great talk John Papa!

  • @SLCoderEgowithCoding
    @SLCoderEgowithCoding 6 років тому

    Nice presentation. I totally liked it

  • @chpecson
    @chpecson 6 років тому +1

    Learned a lot with fun, Thanks.

    • @johnpapa
      @johnpapa 6 років тому

      Great to hear, thanks for watching!

  • @tejasgirase6861
    @tejasgirase6861 6 років тому +2

    #Awesome talk john papa, Like!

    • @johnpapa
      @johnpapa 6 років тому +1

      Thank you!

  • @hieptran5553
    @hieptran5553 6 років тому +1

    you are my idol John Papa

  • @thearchibaldtuttle
    @thearchibaldtuttle 6 років тому +25

    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

    • @johnpapa
      @johnpapa 6 років тому +1

      hehe ... exactly!

    • @sagarkapasi099
      @sagarkapasi099 4 роки тому

      I think this is an old joke. Older then the first mainframe

  • @VincentM_01
    @VincentM_01 6 років тому

    Good presentation, thanks.

    • @johnpapa
      @johnpapa 6 років тому

      you're welcome. thanks for watching

  • @MrYTThor
    @MrYTThor 6 років тому +1

    It would be nice if i had the time for that

  • @danielcortex1648
    @danielcortex1648 6 років тому

    Thank you. That was great for me :)

    • @johnpapa
      @johnpapa 6 років тому

      you're welcome

  • @nskmda
    @nskmda 2 роки тому

    11:49 should actually read like "Comments don't have place in the code"

  • @PieJee1
    @PieJee1 6 років тому

    am I the only one that is annoyed by the first example that getSessions is a getter but does not return a value? One thing I do know about coding is that the naming of the similar classes should be consistent. So every method starting with getXXX returns a value, and every method starting with isXXX returns a boolean.

  • @nasiruddinsaiyed2337
    @nasiruddinsaiyed2337 6 років тому

    Love you Sir !! 😊

  • @NSMetaLpig
    @NSMetaLpig 3 роки тому

    On papa we trust

  • @eliasfrostensson3685
    @eliasfrostensson3685 6 років тому

    What font did he use at 1:22?

    • @johnpapa
      @johnpapa 6 років тому +2

      Operator Mono

  • @TheRoyceCraft
    @TheRoyceCraft 6 років тому +1

    now I just need to learn to code

  • @miguelperezpal
    @miguelperezpal 6 років тому +1

    John Papa === LIKE

  • @Drachensingsang
    @Drachensingsang 6 років тому

    a function can also lie. it's what we call "bug" or "crash".

  • @striker865
    @striker865 6 років тому

    Readable angular JavaScript?

  • @Qexia
    @Qexia 4 роки тому

    Who the hell nests ternary statements?

  • @mbcline
    @mbcline 6 років тому +11

    I find it irritating when so many of the examples of what not to do are unrealistic straw man examples. I can't say I have ever worked in an environment where people intentionally make misspellings in their code, or make comments that repeat what the code says in the way that the presenter was ridiculing here ("//if", "//endif"). In explaining the value of comments, He would do better to emphasize more positive examples of code comments that provide context that the code otherwise would not.

    • @johnpapa
      @johnpapa 6 років тому +2

      Thanks for the feedback. I've seen all of these many times, but I appreciate the feedback and like the idea of showing some other contexts too. I do that in some longer versions of this talk that I give. Thanks

    • @mbcline
      @mbcline 6 років тому +1

      Thanks for the reply, I guess I should feel fortunate that I haven't had those bad experiences. My usual frustration is that the code is not commented enough, perhaps because the developer believes they write "self-commenting" code. I'm all for naming things appropriately, but comments can convey things that code cannot -- e.g. intent and rationale, high-level explanation. Those are the sort of things would be great to see as examples of how to do it right.

    • @xavadu
      @xavadu 6 років тому

      @Ryan Not always, a comment could be a resume of few lines of code which are understandable when you read them, and also depends on the expertise of the developer that is reading it. Comment are not bad beside self or not-self explaining code. What you wrote looks to me more like a justification to don't write comments ;)

    • @mbass77
      @mbass77 5 років тому

      Pros and cons of comment discussed here, from the book "Code Complete": flylib.com/books/en/2.823.1.274/1/

  • @gamehubby
    @gamehubby 6 років тому

    Nice Font @1:34 can I have that for free? =D

  • @codewithnacho
    @codewithnacho 6 років тому

    valideight? Seriously ? And they were laughing at it. How old were these developers? 5?

    • @ghostinplainsight4803
      @ghostinplainsight4803 3 роки тому

      Some idiots at my old work used a utf-8 house for an SCSS mixin library. Every time you needed to refer to a mixin you had to manually find the character then copy and paste it.

  • @edgeeffect
    @edgeeffect 2 роки тому

    Supurb!

  • @connieleung96
    @connieleung96 6 років тому +3

    John Papa looks like Vin Diesel

  • @SunsetRacer
    @SunsetRacer 5 років тому

    Once i've seen a comment :
    It's ugly. i know keep reading

  • @AkkayHT228
    @AkkayHT228 5 років тому

    Brazzers

  • @IlyaRachinsky
    @IlyaRachinsky 6 років тому +1

    This video has spoiler of the key moment from Star Wars :) Be aware

  • @ayalamac
    @ayalamac 3 роки тому

    I'm the guy that haven't watched any movie of star wars and don't care about it.

  • @m4sterkg
    @m4sterkg 6 років тому +1

    el pelon de brazzers

  • @ievgenaznaurov
    @ievgenaznaurov 6 років тому

    John Papa forgot one thing here. To give regards to Robert C. Martin...

    • @johnpapa
      @johnpapa 6 років тому +4

      I credited "Uncle Bob" in a slide, one of his quotes (early)