Some thoughts on the software’s auto-update design pattern

There are so many ways to get the program to have the ability of auto-update. But as I’ve known, there is no way can absolutely make sure the program will update itself as expected. For example, you have defined some data type, in your program and store the data locally. And you have happily distributed your product to thousands users. Then months pass, you add some details to the basic data type. You migrate all the user data properly, and everything gone fine. Not a single complain heard from you users. Things turned complicate when the third time you update your data type. Now you have 3 types of data. Some of your users may be still the oldest version. Fortunately, you have left a tag in the data type to mark the version of the data type. So you take your time to check the version, and implement 2 method to migrate the data.

How about if this pattern continues for around 10 times? How many migration methods you should implement? Nine, of course. But if for some reason some of your users have reversed the version to an old one? From the basic principles of combination, we need 10×9 which means 90 methods to meet the requirement. That sounds crazy.

The main problem is because you can’t be sure whether all the users have always updated to the newest version. In other words, you need to find a solution to sync all the users program version and don’t hurt their data. On one can predict the future, we never know how the data finally like.

To be continued…

A Batch Encoding Convertor for Text File and ID3 Tag

encoding conventor

When copying some of my old project files from Windows 7, the origin system text file encoding made some troubles for me. So in December, I wrote a small tool to help me out. But before days, the same problem came out again when the old mp3 ID3 tagged files met the iTunes. Therefore, I extended the tool to automatically convert the mp3 files to the specified encoding. I used the ID3iconv to help with the tag editing.

Continue reading

A Sketch of a Puppy

My first time to use Corel Painter to draw something. Thanks to the pencil brush tool, it only took about one hour to finish this sketch. And I really miss the Paint Tool SAI on Windows. What I am currently using is Painter 12. To be frank, Painter is the most inconvenient design tool that I’ve used. The keyboard shortcut design is poor, and the tool manipulation is far from good.

Another thing that I learned from this sketch is that Photoshop sucks when handling complex brush painting or natural like painting.

The pen tip of the Intuos 4 feels so loose when you quickly drawing short lines. So I fix the pen tip with some scotch tapes inserting into the pen tip hole. And it really helps. The nice short lines come back again.

puppy

Continue reading

A Simple Python Web Bot Implementation

Here I just want to mention one thing, sometimes it might be more aesthetic use another language to present the comments. The comments will be easier to be found through a bunch of codes.

MSV Application Architecture

I think the general MVC architecture is not perfect enough for a complex dynamic application. The most confusing part of the MVC is it’s Controller. It receives the user sent data, sends commands to change the state of the Model, and also takes the responsibility to change the presentation of the view.

I think it could be simpler:

  • Model
  • Service
  • View

To separate each component’s responsibilities, and make the architecture more open. I replaced the Controller with the Service. The Service only handles the data that the View requests, such as REST, or sends commands to change the Model’s state. All UI logic is moved to the View, and all View requests are async based. So that we can take the full control of the representing flow the application. The front-end developers will only need the client knowledge and skills to construct the dynamic content of the application.

The disadvantages of this architecture are obvious. The client should at least supply a programmable interface. Such as the HTML based web application, the browser should support javascript and the javascript is enabled. And looser coupling means lower performance.