mtelligent

View Original

Software Surgery

Sometimes refactoring feels like surgery. You spend so much time digging into the guts of an application, ripping out stuff and moving large chunks from one location to the other, after a while you begin to doubt the reason you started in the first place.

Right Now, the application is in a strange state. I ripped out large pieces of functionality, moving many things into separate classes and rewrote large pieces of the core piece of functionality that loads, saves and displays snippets in the UI. There are large chunks of code that are commented out, but I feel like I've reached "the black triangle" point in the refactor.

I went from a single assembly with a majority of the codebase in a single file to Eight separate projects each focused on a distinct piece of functionality (Although I am considering using ILMerge to merge them before I distribute). The Entire Solution Compiles and when I run it, the User Interface shows and saved snippets are loaded into the Shell. You can't work with them yet, but the architecture is there. Its just a matter of wiring everything up now.

I ended up defining the interface for Extensions as a relatively simple interface with two method hooks, one that is called on Application Startup and one that is called on Shut Down. Each method receives a parameter that is an interfaced version of the Shell. This interface provides access to an abstracted Folder/Snippet class data structure that can be modified. The shell will then reflect the changes by building actual UI elements and displaying them.

I am also considering replacing the snippet detail view popup with a full screen view that is interactive with the docking toolbar. It should be easier to use when you are trying to edit or manage your snippet library.

Anyway, there is a lot left to do, but I feel like the hard part is done.