Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formalize states of Knit operation #166

Open
t0mpr1c3 opened this issue Oct 4, 2023 · 1 comment
Open

formalize states of Knit operation #166

t0mpr1c3 opened this issue Oct 4, 2023 · 1 comment

Comments

@t0mpr1c3
Copy link
Contributor

t0mpr1c3 commented Oct 4, 2023

At the moment, the Knit operation is governed by multiple state variables that control program flow in procedures such as knit(). These variables include the following members of class OpKnit:

  bool m_lineRequested;
  bool m_lastLineFlag;
  bool m_firstRun;
  bool m_workedOnLine;

plus (m_sOldPosition == position) and so on.

The imperative code works fine but if we want to pursue a more OO programming style it is possible to abstract some or all of these into a sequence of operations governed by the finite state machine.

My suggestion is to leave things as they are for now, but think about making changes if we want to do #105 which will add further complexity to the program flow.

@t0mpr1c3
Copy link
Contributor Author

t0mpr1c3 commented Oct 4, 2023

We can actually get rid of one of these state variables right away by moving the first run from OpKnit::knit() to OpKnit::begin().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant