Create parts of the programs in runtime? writing a software

Hey. In new to programming and I'm currently making a software (a todo list software)

as I'm writing this software I noticed that I get a lot of redundant code, an example is checkboxes. The user can create a task for the day, once the task is added, a checkbox pops up beside the task so it can be "checked" when the task is finished. First I made 10 checkboxes and just made them invisible on the user interface, once the user makes a task a checkbox becomes visible beside it. I realized that this made a lot of redundant code as I needed at least 6 lines of code for every checkbox I make, so I built a method to auto-create checkboxes once the user creates a task at runtime instead, now all I need is one line of code for every checkbox, this, however, complicates the codes later on as I need to refer to checkboxes that are not yet created later on in my codes.

My question is: Is redundant code normal when writing software? should I avoid using methods that create stuff at runtime to prevent redundant codes?

I know this is an arbitrary question, but I would like to know what your guys think about it.

submitted by /u/0krizia
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/A4y9ZST

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close