Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Spliting Room::create() into small functions #156

Open
farodin91 opened this issue Jan 10, 2017 · 3 comments
Open

Spliting Room::create() into small functions #156

farodin91 opened this issue Jan 10, 2017 · 3 comments

Comments

@farodin91
Copy link
Member

Room::create is more than 350 lines of code. This helps make it easier to fix bugs in the function.

@mujx
Copy link

mujx commented Jan 10, 2017

That's true but it's easy code; most of the lines are declarations of event structs. The biggest part of the function is the pattern matching on initial state which cannot be split (maybe a new function?). The only improvement I see is to remove the flags is_something_set and just generate the events in the order specified by the spec. That will generate a few extra events that will be overwritten; that's why the flags exist.

@farodin91
Copy link
Member Author

I think of the following if creation_options.initial_state.is_some() {.

@farodin91
Copy link
Member Author

Moving part in into private function would help reduce doubling, but make it much easier to read since every function has a name and a small doc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants