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

Increase Discovery Cohesion #199

Merged
merged 5 commits into from
Sep 4, 2022
Merged

Increase Discovery Cohesion #199

merged 5 commits into from
Sep 4, 2022

Conversation

William-Brumble
Copy link
Contributor

Short description of change

Software architecture change to reduce unnecessary coupling and increase class cohesion.

lgx_comm.py
Add the discovery network-level business logic previously in the PLC class to the Connection class.
Decided to avoid the unnecessary import of Device by passing in procedural parameter to the interface.

eip.py
Remove the socket module coupling and increase PLC class cohesion by moving the network-level business
logic to the Connection class, where it usually takes place.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • I have read the docs/CONTRIBUTING.md document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read tests/README.md.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

What is the change?

lgx_comm.py
Add the discovery network-level business logic previously in the PLC class to the Connection class.
Decided to avoid the unnecessary import of Device by passing in procedural parameter to the interface.

eip.py
Remove the socket module coupling and increase PLC class cohesion by moving the network-level business
logic to the Connection class, where it usually takes place.

What does it fix/add?

Software architecture change to reduce unnecessary coupling and increase class cohesion.

Test Configuration

I ran example 20_discover_devices without issue.

  • PLC Model
    1756-L84E/B
  • PLC Firmware
    32.014
  • pylogix version
    0.8.6
  • python version
    3.7.7
  • OS type and version
    Winblows Server 2016 Version 10.0.14393 Build 14393

0x26B added 3 commits August 22, 2022 12:08
…moving the network-level business logic to the Connection class, where it usually takes place.
…class to the Connection class.

Decided to avoid the unnecessary import of Device by passing in procedural parameter to the interface.
* increase_cohesion_discovery:
  Add the discovery network-level business logic previously in the PLC class to the Connection class. Decided to avoid the unnecessary import of Device by passing in procedural parameter to the interface.
  Remove the socket module coupling and increase PLC class cohesion by moving the network-level business logic to the Connection class, where it usually takes place.
@TheFern2
Copy link
Collaborator

TheFern2 commented Aug 22, 2022

Thanks for the PR, Is this really a breaking change? Are any tests failing with tox?

https://github.com/dmroeder/pylogix/tree/master/tests

@William-Brumble
Copy link
Contributor Author

William-Brumble commented Sep 4, 2022

Not really breaking, but checked that box due to functionality (routing) change.

Took me a bit to get internet/system setup with everything needed to run all Python versions.

Python versions:
3.10.6
3.8.10
3.7.9
3.5.4
3.4.4
2.7.18

Result:
py27: commands succeeded
py34: commands succeeded
py35: commands succeeded
py37: commands succeeded
py38: commands succeeded
py310: commands succeeded
congratulations :)

I needed to add the tags: Nemesis array, and Str1-50, to the program.
The test cases required them but they were missing from the clx setup files.
The files need to be updated to include those tags.

But the video and readme were very descriptive in getting a test environment setup.

@dmroeder
Copy link
Owner

dmroeder commented Sep 4, 2022

Nice work. I'll update the setup files
Edit: As long as users don't have to change their existing code, I wouldn't consider it a breaking change.

0x26B added 2 commits September 4, 2022 14:20
* update_clx_controller_tags:
  I updated the clx control tag file to include nemesis and str tags needed by the unit tests.
@William-Brumble
Copy link
Contributor Author

I went ahead and updated the controller scope tags for you guys.

@dmroeder dmroeder merged commit 58aef03 into dmroeder:master Sep 4, 2022
@TheFern2
Copy link
Collaborator

TheFern2 commented Sep 4, 2022

Good work! When I run tox, I usually just run latest major versions on 2 and 3. That way you don't have to install every single python version.

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

Successfully merging this pull request may close these issues.

3 participants