Hello! I’m currently learning CS fundamentals through the CS Careerpath and I thought I’d share my first portfolio project! A detailed blog post on the program and how it works can be found here. At the bottom of the post, you’ll find a link to the github repository with all the code for the project. If you get a chance to pop in and look at it, please let me know what you think!
- Don’t use
time.sleepunless absolutely necessary. With
sleeps, it looks like your program is running slowly.
- Validate user input before using it. For example, in the “menu” function, the user can enter “8” or “b” and Python will throw an exception. You can find more information about user interaction in the course https://www.codecademy.com/learn/paths/build-chatbots-with-python.
Available_recipes.txtat application startup if it doesn’t exist. Otherwise you can get a
- I don’t think using a GUI like
filedialogin a console application is a good idea. If you are writing a console application, allow any operations to be performed from the console.
- If you want to use commands from the OS, check the OS name first. What if your application runs on Linux, for example. See sys — System-specific parameters and functions — Python 3.10.2 documentation.
- If you are asking a question to the user like
waitfunction, process the response. For example, I don’t want to continue, I type
n, but the program doesn’t exit. It’s confusing.
- Use a shorter representation for objects in the
__repr__method. The “This recipe contains information on how to make” part does not contain much information about the object. Especially when debugging an application.