?

Log in

No account? Create an account

Previous Entry | Next Entry

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.

Comments

( 1 comment — Leave a comment )
cryo
Dec. 29th, 2001 01:08 am (UTC)
Have at it.. you have the source. Be warned that learning ObjC breaks a lot of the prehistory programming models of the past.

I totally admit that the LivejournalController.m needs to be broken out into other files and the code cleaned up. My goals have been to get the features in as quickly as I can with what spare time I (don't) have, and others can add/clean as they desire. I am always open for suggestion, diffs, design concept changes, and brainstorming.

You can subscribe to the developer's mailing list on http://ljosx.sourceforge.net to keep up with commits and things.
( 1 comment — Leave a comment )

Profile

ijournal
iJournal: Official LiveJournal Client for Mac OS X
iJournal Home

Latest Month

January 2012
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Page Summary

Powered by LiveJournal.com
Designed by Lilia Ahner