Daddy-O à Go-Go (rpkrajewski) wrote in ijournal,
Daddy-O à Go-Go
rpkrajewski
ijournal

Two useful refactorings

LiveJournalController seems to be pretty darned big compared to the rest of the program. There are sixteen static variables in LiveJournalController.m 1.33. This got me to thinking:

It would probably be a good idea to refactor all interaction with the server into its own object. One reason is simple modularity. Another would be hide the complexity of an implementation that allows the UI to remain accessible during network operations -- in particular, sometimes when the LJ server is slow, the program will look strangely blank until the server finally comes back. The idea is to have singleton object that would handle all interaction. Although it could run requests in a different thread, it would still run each request one at a time, in sequence.

There doesn't appear to be a Journal entry data structure, which in this program would be the "Model" of a MVC design pattern. Even if this program never deals with more than one entry at a time, it would be a good parameter to pass around to various functions. Once it is in place, we could add features like a synching and backup.

If I were to put my money where my mouth is, I'd do the Journal entry thing first, because it's simpler (I'm just starting to learn Objective C) and also would appear in the interface of the server interaction manager object.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment