❔ 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
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
Filters/Sorting seems like a good idea
Any help with making the actual code more efficient is welcome
always use prepared statements
consider not erasing and rewriting the entire database every time a task is added
Could you elaborate?
The database isn’t erased each time?
@chucklesthebeard
AddTask calls SaveTasksToDatabase which runs
DELETE FROM Tasks
...
ok my bad, the whole database isn't erased, but the whole Tasks table is.Would any of you happen to have a tutorial for Dapper that explains things clearly?
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
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.