Week 7 – Generalizing

This week was a little lackluster. I did not have a large problem that needed solving, instead I had a handful of little things to fix or add to my program. I spent a good amount of time thinking: “What does this program need? What can I add to it?” This on of my least favorite things to do in coding. Having a well defined purpose is really what makes coding fun.

I found a way to edit the stroke widths of all the lines and shapes in the file. The next logical step was to make a method to edit any attribute of the file. I took what I had done for changing the stroke width and generalized it to take any attribute and change the value to anything. This was pretty simple and really useful for the editing of the file.

I also needed a way to delete paths in the file. The way I accomplished this was not as optimal as I would have hoped. I found the endpoints of the line I wanted to delete. I then searched the file for a line that had the same endpoints. And then I deleted that section from the text of the file. I think I was caught up in my “plaintext solution,” so I did not think much about better ways to do this. I think I can use the element tree function of the library I was using and deleted the line that way. This would have been much more elegant.

I found that I often started coding without proper research or planning. This is something that will try to remedy in the future. Planning is there to reduce time and confusion. I often forgot this.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s