Skip to content

Changing the API to use reference classes? #10

@nsheff

Description

@nsheff

Given that the BEDbase() object is a client that connects to a server, it seems to me that this is an appropriate use of a Reference Class, because we don't really need duplicates of this object; we just need 1 client and then whatever functions use it can just use that.

It also makes more sense to me for the user to do something like this:

bb <- BEDbase()


bb$list_beds()

Rather than the current approach of passing the api in to the functions, like bb_list_beds(api).

This has the advantage that I can type bb$ ... and then tab complete and get REPL feedback as to what methods are available.

Maybe this is less idomatic for R, but I find this approach more intuitive and I think reference classes made this approach possible. Would love to hear your thoughts.

So I think the 2 advantages of using reference classes would be:

  • improved efficiency, since it wouldn't then require duplicating this client to use it?
  • cleaner user interface (in my opinion)

but I'm not super confident in all these things, so it's just an idea for consideration/discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions