If you'd like to use the site and help me test it, you can join here.

Thursday, April 16, 2015

Refactoring is Ripping the Seams of Code

So... have you ever ended up in a situation where you felt you need to redo things to fix them up properly? I do (and it's not only with that curtain where I sewed the ruffle tape on wrong way).

I started a bunch of months ago to frantically build something I know people will be interested in using, but I didn't have all the skills or tools I needed. Now that I come to think of it, I think I'm a bit like these people who suddenly show up and want to start their sewing career by doing a full-fashioned extravagant wedding dress. Just that my extravagant wedding dress happens to be a website.

So I made things and built them the way they came to my mind - often experimenting wildly since I didn't know how to do things the right way. I ended up with a good deal of possible solutions and little gadgets. Now I'm cleaning up things. I'm undoing the things that I learned how to do better and I'm redoing them in a consistent, simpler, better fashion.

One reason why I ended up where I am is that I listened to people saying "don't reinvent the wheel" - which means to use existing solutions instead of making your own. That's not bad advice, actually - if I had done everything I have working now from scratch, things would probably look much worse because I wouldn't have taken the opportunity to learn from the existing solutions. My problem with this was I couldn't really tell a good wheel from a bad wheel reliably initially. So I ended up using some really great freely available solutions and some not so good ones. Now I'm moving away from the bad ones, one at a time.

With some of these solutions, I used very little of the functionality they offer. And that is a huge problem when you want to make a site that works nicely on mobile devices: Things that are loaded but never used are wasteful. On a fast internet connection, you hardly notice any difference, but on a slow internet connection waiting for things to load quickly gets very annoying. That's why I'm working on reducing the number of libraries - usually by writing my own code that replicates just the functionality that I actually need for the site.

With a few weeks of using CSS (and learning things with the help of some great free tutorials) and redoing the front-end part of the site from scratch, I can't call myself a designer yet. Still, I think that the new design is going to be a great improvement over how things were. At least I now have something that I fully understand since I made it from scratch - previously I was using an existing CSS framework. I feel that knowing something in detail makes it much much easier to change and adapt.

I know that this is a healthy process. There's a part of me that wants to see quick results, but I think ripping and redoing things is more helpful in the long run.


What do you think: Is it more important to ask questions and do as your elders say or to experiment and discover your own way of doing things?

No comments:

Post a Comment