Giter Club home page Giter Club logo

iglookup's People

Contributors

donaldchen avatar

Watchers

 avatar  avatar  avatar

Forkers

donaldchen

iglookup's Issues

Extract SSH connection methods into its own class

Problem

Currently, SLAssignment has methods and calls to SSH client and does all the bash jobs. We need to create a better abstraction so SLAssignment and other model classes only worry about keeping properties up to date and saving.

Tasks

Create a dedicated class to manage SSH connection and bash commands. Call it SSHManager or something. All classes and methods that need to use SSH should call certain methods through this class.

Suggestions

  • This manager class should be the only one to keep a reference to the current session, and an NMSSHSession instance.
  • This class should run bash scripts, and return the results as an objective-c object. It should not be too smart and try to create SLAssignment or else it will be a violation of abstraction. The caller is responsible for parsing the data. In this case, the caller is most likely going to be SLAssignment and SLAccount.

Use Cases

SLSSHManager *SSHManager = [[SLSSHManager alloc] init];
[SSHManager openConnectionWithUsername: (NSString *) username 
                           andPassword: (NSString *) password]
if (SSHManager.isActive) {
    NSArray *assignments = [SSHManager getAssignments];
    //here assignment contains a list of assignment data, however these assignments are represented is up to you, as long as they are not directly creaing an instance of SLAssignment or our other model classes.
}

Fix distribution graph

Problem

Currently the distribution graph is all sorts of weird. Fix it

EDIT (by Donald):
The graph cuts off digits along the axis when there are 4 or more digits.
White line space between bars looks too thin.
Replace dark gray bar color with a prettier color.

Tasks

Learn CorePlot and optimize the look of distribution graph.

Handle case when an account has no grades

The app crashes if the account has no grades, and the user tries to view the list of assignments. One solution is to just display a message to the user that says "no grades have been entered" instead of not catching the exception.

EDIT: The app sometimes crashes when trying to access any assignment without a grade even when other assignments have grades. The app always crashes when trying to view "extrapolated total."

Create new Account class that replaces current Account and AccountBook

Problem

Currently Accounts are managed by AccountBook and functionalities are split between two. There is no need for a manager service, so to make code cleaner, we can combine Account and AccountBook to one class, following the convention of singleton model class.

Tasks

Combine Account and AccountBook into the following class

// these properties must be accessible for an instance of this class
@property NSString *userName;
@property NSString *className;
@property NSString *password;
@property NSArray *assignments;

// returns an array of all the saved accounts (SLAccount instances)
+ (NSArray *) findAll;
// returns an account identified by its unique name
+ (SLAccount *) findByClassName: (NSString *)className;
// creates an instance of account and return it
- (id)initWithClassName:(NSString *) className 
               username:(NSString *) username
            andPassword:(NSString *) password;
// save changes made to this instance of SLAccount
- (void)save;
// delete this account from saved data
- (void)delete;
// opens SSH connection if possible, returns success or failure
// if already open, don't do anything
- (BOOL)openSession;
// closes SSH connection
// if already closed, don't do anything
- (void)closeSession;
// updates assignments, get all possible information (distribution, etc), and save them
- (void)updateAssignments;

Use Cases

// Find all the accounts
NSArray *allAccounts = [SLAccount findAll];

// Find one particular account
SLAccount *account = [SLAccount findByClassName: @"CS184"];

// Save changes
account.className = @"AWESOME-CS184";
account.userName = @"cs184-bw";
account.password = @"LenLenShiteageru";
[account save]; //automatically saves into Keychain and plist

// Delete an account
SLAccount *inactive_account = [SLAccount findByClassName: @"CS70"];
[inactive_account delete];

// Add a new account
SLAccount *new_acct = [[SLAccount alloc] initWithClassName: @"CS188"
                                                  userName: @"cs188-js"
                                               andPassword: @"abc"];
[new_acct save];

Suggestions

  • Use plist to store data instead of NSUserDefaults, see this tutorial on how to use plist. We shouldn't be using NSUserDefaults to store assignment data since they aren't settings.
  • Use a dedicated class to manage saving and retrieving data from plist and Keychain. Call it DataManager or something. Note that our Account, Assignment and other model classes should not worry about the details of saving, deleting and retrieving data. It should rely on DataManager to do that. This is a good abstraction.
  • Don't worry about parallelization yet

Improve distribution graph and axis

  1. fix the lowest bar which is always half the height of the other bars
  2. adjust the axis or bars so that the bars lie between the tick marks instead of centering on the tick marks
  3. The graph is not centered vertically

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.