Bad Code Is Good

Поделиться
HTML-код
  • Опубликовано: 26 окт 2024

Комментарии • 44

  • @cl4rk_sh
    @cl4rk_sh 3 месяца назад +182

    this aged very well over the span of a few hours

    • @TroiCodes
      @TroiCodes  3 месяца назад +75

      Very funny timing lol.
      Core systems at massive scale cyber security companies supporting infrastructure for millions is a good example of a place where you probably don't want to write hacky code....

    • @Omena0
      @Omena0 3 месяца назад +12

      ​@@TroiCodesthe driver was literally filled with zeroes lmao

  • @manuszmark
    @manuszmark 3 месяца назад +42

    "Not over engineered" != "Bad code"
    But we agree on the core principle: Unjustified complexity is a bad thing

    • @TroiCodes
      @TroiCodes  3 месяца назад +7

      I’m not just talking about things that are over engineered. I think sometimes when you need things urgently or when the business wants to experiment with a feature you can actually implement inefficient hacky code to prove out the need before building something more solid.

    • @manuszmark
      @manuszmark 3 месяца назад +1

      ​@@TroiCodes
      I think we have a different definition of "Bad Code"
      I think complexity, feature set and refinement has nothing to do with "quality". In my opinion, the code is "bad" if it does not fulfill its purpose. A prototype's purpose is difficulty evaluation and experimentation. If it is not meant to be relied on or it's easy to replace (with well defined interfaces) while it provides insights to an unknown area, then it fulfills its purpose.
      On the other hand, if a piece of code is well documented, well tested and refined, but it fails to be a stable foundation for future features, then its bad code. You don't gain anything if you have to rework most of your foundation to implement a simple feature.
      Documentation, tests and uniform coding styles improve the Time-To-Understand and can help increase the "quality", but if the code is "bad", then its like a barely functioning car with all the luxury features: It might not always stats, but at least its cold in the summer.

    • @gizmibob
      @gizmibob 3 месяца назад +1

      When you need something urgently you contract technical debt.

  •  3 месяца назад +47

    "poorly abstracted" - I would definitely take "not abstracted" over that! Code with a lack of abstractions, i.e. very procedural and lots of repetitive code, that's the best "bad code" in my experience. When the time comes, it's so easy to sail through that code and create very good abstractions based on the information the code is presenting to you.

    • @TroiCodes
      @TroiCodes  3 месяца назад +1

      Good point! Honestly, that would have probably been a better way to word what I was getting at. Not everything needs to be built to solve a ton of use cases. You make a great point as well that code that's not abstracted is a great starting point for building abstractions ontop of when the time is right since you already know exactly how you'd want to consume said abstraction.

  • @theguitarslinger1
    @theguitarslinger1 3 месяца назад +2

    To everybody commenting, "Worst timing, lol!" The target audience for this video obviously isn't people writing kernel-level security software that powers half the internet.
    It's for the 15 person agency that will get 3 chat requests per day, that will never scale to need millions of concurrent requests, and if they do, that's a very good problem for them to have (and at that point they can throw money and developers at the problem).

  • @hippopperbear
    @hippopperbear 3 месяца назад +74

    This is the worst timed video of the year

  • @BattyBest
    @BattyBest 3 месяца назад +18

    Very agree- no point in building an api system with a hyper-accurate token bucket if the whole thing is in-house and called a grand total of once in the code.

    • @TroiCodes
      @TroiCodes  3 месяца назад +2

      That sounds oddly specific haha. I totally agree!

    • @BattyBest
      @BattyBest 3 месяца назад +4

      @@TroiCodes I find that oddly specific examples tend to drive the point home more than generic examples.

  • @SufianBabri
    @SufianBabri 3 месяца назад +18

    I think a better term will be "Imperfect code". Bad code gives negative vibes, such as "if you change this code, the app crashes for some weird reasons".
    Often times we waste time by perfecting our code, which hinders us from building something meaningful. The opposite is to write really convoluted and obfuscated code. It may help you in achieving your short-term goals but it may not be long before you regret it when management starts to question why every minor UI change takes a few days to complete. Only experience helps you decide the best trade-off.

    • @phost9011
      @phost9011 3 месяца назад +1

      maybe it's more accurate to say it like you, but i would not have understood it as well as a junior developer. i feel disgust at myself when i write something i know could be better, and saying it with a more negative way lessen my apprehension of doing it. maybe it's too personal, idk.

    • @TroiCodes
      @TroiCodes  3 месяца назад +1

      That was the goal! I have been talking a lot about this in feedback sessions with more junior developers which is why I phrased it like I did. I agree "imperfect code" is a much better term for what I'm describing but I don't think it hits home quite the same way "bad code" does for more junior engineers.

  • @BobKane-g6x
    @BobKane-g6x 3 месяца назад +5

    A developer at CrowdStrike took your advice.

  • @taylorallred6208
    @taylorallred6208 3 месяца назад +3

    The simplest, dumbest code that gets the job done is the best imo

  • @dylsplazy
    @dylsplazy 3 месяца назад +17

    This aged like milk in like a day. You: ah yes write bad code... bad code: takes down half the internet with bluescreens.

  • @liylaliyla
    @liylaliyla 3 месяца назад +20

    recommended aboutt to go wild with this one

  • @bhavanimantur214
    @bhavanimantur214 22 дня назад

    Thank you for inspiring me to code more and i have realised when errors occurs i am able to sort the errors and this makes me feel that today i have learnt something new.😊

  • @oscarfriberg7661
    @oscarfriberg7661 3 месяца назад +4

    I agree with the sentiment, but I think you’re describing is “mediocre code”.
    Bad code is often over engineered, where the wrong tools have been used and is broken with lots of barely understood edge cases. It’s code that provides negative business value over time.

  • @mrtophatcat6473
    @mrtophatcat6473 3 месяца назад +14

    welp
    this aged well.

  • @ShadowKestrel
    @ShadowKestrel 3 месяца назад +1

    "yeah so we're going to deploy a scalable sharded database over several kubernetes clusters with multiple caches for performance"
    "dude we are storing literally fifteen kilobytes of data here. why"

  • @gustavosalmeron2013
    @gustavosalmeron2013 2 месяца назад

    As I've evolved my programming skills, I have noticed that the more organized I develop my systems, the easier it is for mantaining them. The only situation where "bad code" was a proper choice, was in situations where the codebase was already bad and I had to make some weird hacks to deliver a feature.
    In the end, a bad code is just... bad. There is a minimum quality threshold that you need to achieve, simple stuff, that's enough. You don't need to make a masterpiece, just don't commit any programming crimes..

  • @nathanfranck5822
    @nathanfranck5822 3 месяца назад +2

    Here's some nuggets
    - stay away from fancy data structures if you can just use a hashmap
    - try forming your code as a long recipe where immutable things are created and consumed
    - break out functions and classes very late, maybe never
    - add validation and types at the edges of your interface (input and output) and don't worry about the middle (if it doesn't mutate things or interact with the outside world)
    You should think of useful code as a little factory conveyor belt with machines along it doing meaningful changes to the end product.

  • @stefnirk
    @stefnirk 3 месяца назад

    Great video; my philosophy is as long as you write tests, we can always come back to it later and make it better if needed.

  • @toffet
    @toffet 3 месяца назад +7

    so funny to watch this now

  • @benjidaniel5595
    @benjidaniel5595 3 месяца назад +1

    You’d love me. Bad code is my forté

  • @yosephalabdulwahab4151
    @yosephalabdulwahab4151 3 месяца назад +13

    So you’re the one who inspired the the intern who pushed bad code from crowdstrike!!! 😮
    Jk 😂

    • @TroiCodes
      @TroiCodes  3 месяца назад +5

      Just bad timing I swear LOL!

  • @indianjitsingh
    @indianjitsingh 3 месяца назад

    So many people mindlessly commenting about this aging like milk due to the Crowd-strike bug. What you are suggesting does not align with what happened at crowd-strike.

  • @CattenLinger
    @CattenLinger 3 месяца назад +1

    i think it might be better if the “bad code” is quoted. 😀

  • @Metruzanca
    @Metruzanca 3 месяца назад

    Cheeky flex in there (~3:15)

  • @MindOfT1m
    @MindOfT1m 3 месяца назад

    I agree, you learn from your mistakes, get better like AI but keep the human element.

  • @Jasonlhy
    @Jasonlhy 3 месяца назад

    It is very difficult to write good abstraction that aged well.

  • @Aeduo
    @Aeduo 3 месяца назад

    Corpo guys goes on about the usual throwing together a bunch of technical debt and god forbid would code be reused and contributed to for the rest of the world. Got some real lizard people mentality in this one. :p

  • @RemotHuman
    @RemotHuman 2 месяца назад

    if its good its not bad, so you are really saying people are wrong about what code is bad

  • @vlad_nikiforov40
    @vlad_nikiforov40 3 месяца назад

    let badCode; badCode = !badCode