Refactoring a Python Data Validation Interactive Shell

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 15

  • @ArjanCodes
    @ArjanCodes  11 годин тому

    👉 Check out brilliant.org/ArjanCodes/ to try Brilliant for free for 30 days, and get 20% off an annual premium subscription.

  • @TomDonahue
    @TomDonahue 10 годин тому +9

    Thanks Arjan! This was painful in all the right ways :) My first programming language exposure was C# (through the Unity game engine), and it's a language that really encourages abstractions and "clean code" principles. In the command and commandargs classes, I was trying to enforce something similar to C#'s interface structure, and definitely overcomplicated things. I need to get KISS and YAGNI signs posted to my desk...
    Loved the suggestions, loved the refactor--thanks for taking the time to go through this!

    • @ArjanCodes
      @ArjanCodes  9 годин тому

      Hey Tom, thank you for being courageous and submitting your code. It was a lot of fun working on it and I hope the second pair of eyes helps you improve your skills. And feel free to disagree with some of the things I did - there’s always an aspect of personal taste to development.

  • @yassineboujerfaoui1160
    @yassineboujerfaoui1160 4 години тому +1

    Really like the way you've resolved the Liskov substitution principle violation in 28:01 (which was hidden with a `type: ignore` comment) through functions.
    I've personally would've gonna for making `Command` classes a generic class as a function of `CommandArgs` classes. But after seeing this, using functions really makes sense!

  • @Forseti2
    @Forseti2 6 хвилин тому

    I'm really like I've chosen Pycharm at the beginning. It offers many convenient things, eg that moving of code Arjan struggled littlebit with in VSCode - Pycharm automatically refactor imports according the change you made when you moved files to other folder.

  • @romanroman4665
    @romanroman4665 10 годин тому +2

    yeah, python refactoring series ☺

  • @TheScott10012
    @TheScott10012 11 годин тому +5

    So they made a less flexible data exploration in cli instead of a notebook?
    I think as part of your code reviews you should also give feedback on whether decisions made before even writing code are good ideas...

    • @ArjanCodes
      @ArjanCodes  10 годин тому +16

      I disagree. I don't want to make any assumptions about the motivation of the developer. Not all tools are aimed to be used by tons of people. There are plenty of projects that developers work on that have a different goal, ranging from learning about a particular technology (such as how to build a CLI), or wanting to have something simple for internal use or as part of an automated script (in which case a notebook won't work).

    • @joshuadonahue5871
      @joshuadonahue5871 10 годин тому +4

      So they wrote a computer program instead of riding a bycicle? I think as part of your code reviews you should also give feedback on whether decisions made before even writing code are good ideas

    • @zstrout
      @zstrout 6 годин тому

      I have something similar that I use all the time. But I 1) just use the python REPL instead of my own custom CLI and 2) change some environment variables in windows (I also did something similar in Linux too) so that I can right click on a file and have an "open in pandas" option that passes the file name as an arg to the script then creates an interactive session with the variable `df` as the dataframe of the file. I then use regular python commands to manipulate the data or plot it. This is like a step between excel and a notebook. It is really a godsend for huge csv or xlsx files that take forever to load in excel.

  • @FighterAceee94
    @FighterAceee94 7 годин тому +1

    Arjan you mentioned settings at the end of the video. I'd love to hear your thoughts on setting up an INI configuration file in combination with a Settings GUI and loading of these settings into the application. My GUI project uses very diverse settings all over the codebase, and I'm torn between the current system and some sort of a centralized setting value handling system.

    • @greyshopleskin2315
      @greyshopleskin2315 6 годин тому

      For settings I like pydantic-settings.
      You can just create a model and you can configure it to automatically read values from environment variables, a .env file, toml and more formats

  • @hoseynamiri
    @hoseynamiri 11 годин тому +3

    Wow! I love your refactoring videos! Please make code roast. Would you go over a library I built?

    • @ArjanCodes
      @ArjanCodes  11 годин тому +3

      Glad you like them! You can submit your code for a roast on my Discord server (there's a dedicated channel). To join, go to: discord.arjan.codes.

  • @ramimashalfontenla1312
    @ramimashalfontenla1312 3 години тому

    Like DocDB video!