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

Feature/web app organization #216

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

TekuConcept
Copy link
Contributor

  • 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.

@TekuConcept TekuConcept requested a review from kylerjensen March 23, 2017 18:01
CHANGE
);
while((!Serial.available())||(Serial.read()==0));
controllers[1] = new ThrustController(MOVE_PIN);
Copy link
Contributor

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.

Copy link
Contributor

@kylerjensen kylerjensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@kylerjensen
Copy link
Contributor

I think a second review on this PR would be good just because it's so large @nfcopier

@nfcopier
Copy link
Member

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.

@kburgon kburgon self-requested a review June 1, 2017 01:17
powerManager.turnOnEscs();
},
turnOffEscs: function() {
DMSG("Turn Off Escs");
Copy link
Member

@nfcopier nfcopier Jun 21, 2017

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.

Copy link
Contributor Author

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');
Copy link
Member

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.

Copy link
Contributor Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid unnecessary abbreviations.

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@nfcopier
Copy link
Member

I really like most of these changes. Awesome job. 👍
Just got a couple tweaks for ya. I also think it would be a good idea for us to talk about dependency injection, encapsulation, and component decoupling/cohesion in person sometime.

@TekuConcept
Copy link
Contributor Author

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.

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