C
C#16mo ago
AceChewy

❔ Ideas to improve existing code

I created a simple tasks programs about 3 weeks ago and took a break from coding for a while after burning out and I'm trying to improve it further now, be it adding more features or making it run more efficiently. The code currently allows the user to create tasks and save them, each task is given an estimated duration and priority. Users can choose to add, remove or show tasks. I'm planning on implementing Dapper to make writing to the database easier and a GUI once I've learned some WPF. Anything extra features anyone would personally want in app managing your tasks?
11 Replies
Angius
Angius16mo ago
Beautifying it a little with something like Spectre.Console would be nice, before you go full WPF Maybe the ability to sort tasks by duration And sorting by priority, of course
AceChewy
AceChewyOP16mo ago
Filters/Sorting seems like a good idea
AceChewy
AceChewyOP16mo ago
AceChewy
AceChewyOP16mo ago
Any help with making the actual code more efficient is welcome
Joreyk ( IXLLEGACYIXL )
always use prepared statements
ChucklesTheBeard
ChucklesTheBeard16mo ago
consider not erasing and rewriting the entire database every time a task is added
AceChewy
AceChewyOP16mo ago
Could you elaborate? The database isn’t erased each time? @chucklesthebeard
ChucklesTheBeard
ChucklesTheBeard16mo ago
AddTask calls SaveTasksToDatabase which runs DELETE FROM Tasks ... ok my bad, the whole database isn't erased, but the whole Tasks table is.
AceChewy
AceChewyOP16mo ago
Would any of you happen to have a tutorial for Dapper that explains things clearly?
Joreyk ( IXLLEGACYIXL )
https://www.learndapper.com/parameters this explains prepared statements and why its important to use them
Dapper Parameter, SQL Injection, Anonymous and Dynamic Parameters
Dapper allows specifying parameters in querying methods to avoid SQL Injection. Learn more about how to use anonymous, dynamic, string, and output parameter
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server