-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/web app organization #216
base: develop
Are you sure you want to change the base?
Conversation
TekuConcept
commented
Mar 22, 2017
- Routes are now in their own file, reducing index.js file size and perceived complexity.
- Hardware specific calls have been moved to their own file. Route calls to hardware are made through a messenger.
- Hardware initialization and management are now hidden behind an app module. This module exposes the already-created factories to AI scripts.
- Removed experimental snippets, such as task-script implementations, in favor of promoting more organized approaches of execution and testing.
CHANGE | ||
); | ||
while((!Serial.available())||(Serial.read()==0)); | ||
controllers[1] = new ThrustController(MOVE_PIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might consider adding integer constants for these array indices in the future, but it doesn't prevent approval of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I think a second review on this PR would be good just because it's so large @nfcopier |
I'm pretty sure this pull request inherits changes from a couple of the previous PRs. I completed a review of #212. Check that one for my requested changes. |
powerManager.turnOnEscs(); | ||
}, | ||
turnOffEscs: function() { | ||
DMSG("Turn Off Escs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a logger. Use it. Also, this type of psuedo-macro looking naming does not feel appropriate for JavaScript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was temporary (DMSG) - I forgot to delete it.
(Right now I'm not sure about the current integrity of the Logger object. I didn't change any of the code for it, but some portions of it were broken before I even started the WebBrainUpdate branch.)
@@ -0,0 +1,36 @@ | |||
var hdwr = require('./hardware.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file feels more than a little redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt the same. There were some occassions in other projects where this wasn't the case for me. Feel free to refactor it out.
@@ -0,0 +1,138 @@ | |||
module.exports = function(app, msngr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid unnecessary abbreviations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those moments when history begins to haunt you. (I would have named "msngr" => "messenger")
var HardwareFactory = require('./CppInterface/Factory.js'); | ||
var Vision = require('./VisionInterface'); | ||
|
||
var server = Sockets.createSocket(Ports.DispatcherPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is breaking encapsulation. These sockets should have been left inside the Factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to disagree. App.js (while improperly named) is a form of "builder" design pattern. (The builder design pattern is one of the 23 discussed by the Gang of Four.)
A builder will take advantage of factories to create more complex objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I will admit that this builder module does need to be better organized.
I really like most of these changes. Awesome job. 👍 |
I finished reading the "Design Patterns" book cover to cover as well as "The Clean Coder" and I am in the middle of the book "Clean Code." I feel I have a better idea now about writing amazing clean code. |