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!
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.
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!
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.
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...
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).
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
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.
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.
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
👉 Check out brilliant.org/ArjanCodes/ to try Brilliant for free for 30 days, and get 20% off an annual premium subscription.
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!
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.
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!
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.
yeah, python refactoring series ☺
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...
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).
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
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.
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.
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
Wow! I love your refactoring videos! Please make code roast. Would you go over a library I built?
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.
Like DocDB video!