Model spec

Feb. 21st, 2016 04:22 pm
marnanel: (Default)
[personal profile] marnanel posting in [community profile] dwim
Here's a draft specification for the model in Dwim. It's written abstractly rather than WRT any particular implementation. There's a lot of functionality missing because this is only for the first iteration. Suggestions and comments are very welcome.

class Fetcher
This fetches files over HTTP(S). It deals with caching according to the HTTP headers, and maintains the cache (including an upper limit on the cache's size).
It also uses Shrinker to degrade incoming images.

class Shrinker
This optionally scales incoiming and outgoing images down, to save space and bandwidth. It can be disabled in settings.

class Dwlib
This fetches HTML from Dreamwidth using Fetcher, and returns results represented by various classes, given below.
Its constructor requires the username of the account to log in with.
It caches cookies and passwords for each known account.
Any method, other than the login method and the constructor, can throw an exception if the cookies are unknown, stale, or rejected by the server.

class Post
A post. It may be someone else's post, retrieved from the server; it may be this user's post, waiting to be sent as soon as we get back online; it may be a draft post.
The class allows us to know only part of the information about the post, and to download other information about it as requested.

class Timeline
A chronological series of posts-- a user's timeline, a reading page, or a community.
Most Timelines represent the newest "n" posts for a particular timeline. But they can also represent posts made by a particular user in a particular month.
There is a method to return the number of posts currently known.
If you try to access posts beyond this number, the Timeline will attempt to fetch more.
There is a method to retrieve all posts on a timeline made since the last fetch.

class User
A user. This will only be rudimentary in the first iteration.

class UserSet
A set of Users. Used for making filters and reading-circles.

Date: 2016-02-22 12:35 pm (UTC)
From: [personal profile] swaldman
I don'tknow enough of Android or object oriented architecture to be useful perhaps, but thrre thoughts occur:

1. Are there not existing platform libraries to handle things like what your Fetcher class does?
2. Is there any point in scaling incoming images on the client? Or is this something that ought to be implemented server side? Agree that reducing outgoing images is important, since smartphone cameras often have crazy pixel sizes.
3. Whether or not it's in the initial iteration, I think it's important to think in terms of a local store that syncs for offline use. I'm not sure whether that's allowed for above or not.

Hope that's of at least some little help :-)
Edited Date: 2016-02-22 06:12 pm (UTC)


dwim: the dwim logo (Default)
Dwim the Android client

June 2016

56 7891011
26 27282930  

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 22nd, 2017 08:25 pm
Powered by Dreamwidth Studios