The objective is to create a custom action that returns the RTT from any requested domain. In other words I want to tell the assistant to Ping whatever domain and provide me with the RTT or respond that the server isn't reachable. Whereas I'm not ignorant or unable to research and apply results, I've not seen any similar project or a web-hook that would be easily applied. I've got some IFTTT experience and have created Glitch projects that have provided me with additional utility for the assistant. Honestly ''created'' is an overstatement, implementation was just a little step above script-kiddie abilities. The result was that the assistant now provides me with more functionality to control my media center on a Firestick than Amazon's skill does.
So, my assumption is that this is a pretty low level skill. I have no interest in this being anything other than a personal action. That said, I can handle invocation and all the other overhead necessary for human interface...etc but would surely appreciate assistance, references to similar projects or a helpful overview of what one thinks is the best method to accomplish the task.
If you are reading this and wondering why I posted here, please provide me with a more appropriate or topical forum location.
TIA
Related
I am looking for feedback on a certain directory structure for an application. I realize that this does not follow the classical stack overflow format where there is such a thing as "a correct answer", though think it is interesting nonetheless. To provide meaningful feedback, some context first needs to be understood, so please bear with me.
--
Two colleagues of mine and I have created an application that uses the Clean Architecture. HTTP requests to routes get turned into request models, which gets handed to use cases, which then spit out a response model that gets handed to a presenter.
The code is fully open source and can be found on GitHub. We also have some docs describing what the main directories are about.
We are thinking about reorganizing our code and would like to get feedback on what we've come up with so far. Primarily amongst the reasons for this reorganization are:
Right now we do not have a nice place to put things that are not part of our domain, yet somehow bind to it. For instance authorization code, which knows about donation ids (with authorization not being part of the core domain, while donation ids are).
It's nice to group cohesive things together. Our Donation code is cohesive and our Membership Application code is cohesive, while both don't depend on each other. This is closely related to the notion of Bounded Contexts in Domain Driven Design. Right now these contexts are not explicitly visible in our code, so it is easy to make them dependent on each other, especially when you are not familiar with the domain.
These are the contexts we have identified so far. This is a preliminary list and just to give you an idea, and not the part I want feedback on.
Donation
Membership
Form support stuff (validation of email, generation of IBAN, etc)
The part I want feedback on is the directory structure we think of switching to:
src/
Context_1/
DataAccess/
Domain/
Model/
Repositories/
UseCases/
Validation/
Presentation/
Authorization/
Context_2/
Factories/
Infrastructure/
tests/
Context_1/
Unit/
Integration/
EdgeToEdge/
System/
TestDoubles/
Context_2/
The Authorization/ folder directly inside of the context would provide a home for our currently oddly placed authorization code in Infrastructure. Other code not part of our domain, yet binding to it, can go directly into the context folder, and gets its own folder if there is a cohesive/related bunch of stuff amongst it, such as authorization.
I'm happy to provide additional information you need to provide useful feedback.
Right now we do not have a nice place to put things that are not part of our domain, yet somehow bind to it.
Right now these contexts are not explicitly visible in our code, so it is easy to make them dependent on each other, especially when you are not familiar with the domain.
There are both technical and non-technical ways to address this issue:
You can enforce stricter separation through class libraries. It is more obvious you are taking a dependency on something if you have to import a dll / reference another project. It will also prevent circular dependencies.
Code reviews / discipline is a non-technical way to handle it.
I've been using Hexagonal Architecture with DDD where the domain is in the middle. Other concerns such as repositories are represented by interfaces. Your adapters then take a reference to the domain, but never in the other direction. So you might have an IRepository in your domain, but your WhateverDatabaseRepository sits in it's own project. It is then the responsibility of the application services / command handlers to co-ordinate your use cases and load the adapters. This is also where you would apply cross-cutting concerns such as authorization.
I'd recommend watching Greg Young videos (try this one) and reading Vaughn Vernon's IDDD as it goes into how to structure applications and deals with questions like yours. (sorry that my answer is basically watch a 6hr video and read a 600+ page book, but they both really helped clarify some of the more "wooly" aspects of DDD for me)
As an example, see https://github.com/gregoryyoung/m-r/blob/master/SimpleCQRS/CommandHandlers.cs
I have to write a program that tests products fully automatic.
I still don't have the finished prototype board but i have an development board for the I.MX6UL processor
see picture below
http://www.nxp.com/products/sensors/gyroscopes/i.mx6ultralite-evaluation-kit:MCIMX6UL-EVK?
My first task is to put an uboot and linux file system on the board trought TCL code => asked by customer.
This all have to be done trough a usb connection that is connected to the development kit board.
NXP provide some tools that is called MFGTOOL2 => with this i can install a fully working linux but ofcourse i need to do this with code scripting and not via a tool because it's for production testing.
All this has to be installed on an nand flash ?
Your question is very vague and likely to not be useful to others as so much of it looks specific to your development environment. This means that the first step is going to be for you to do some research so that you can learn how to split the project up into smaller tasks that are more easily achievable. One of the key things is likely to be identifying a mechanism — any mechanism — for achieving what you want in terms of communication (and enumerating exactly what are the things that will be communicating!) Once you know what program to run, API to call or message to send, you can then think “How do I do that in Tcl?” but until you are clear what you are trying to do, you won't get good answers from anyone else. Indeed, right now your question is so vague that we could answer “write some programs” and have that be a precisely correct (but unhelpful) reply to you.
You might want to start by identifying in your head whether the program will be running on the board, or on the system that is connected to the board, or on a system that is remote from both of those and that will be doing more complex management from afar.
I recently discovered this very useful Netbeans tutorial for creating a simple JSF 2 CRUD application http://netbeans.org/kb/docs/web/jsf20-crud.html. The final product has somewhat limited usability as one is confronted with a myriad of web pages. I would like an example of how to consolidate the Create and Edit forms (using the same project if possible). This seems more in keeping with how a person would actually enter such information and would reduce the risk of data entry mistakes. Why enter a client and their billing address on separate screens? One should be able to add or remove addresses, if need be, on the client's edit form. Or if a new client has multiple addresses, enter them all on the client's create form. The application just seemed incomplete with no further tips on how to improve it. If one has knows of a useful book that covers this, then I would gladly read that as well. Thanks.
I didn't realize the complexity of my problem and found that I couldn't get what I needed using JSF2 with the information resources available. Through my searches, I also found that many others were asking about Master-Detail CRUD applications, which I then learned was what I needed, but in slightly different ways and not getting any solid examples. A problem properly stated is half solved and I didn't know the problem statement. Armed with more knowledge, I was shocked to find that the answers were not readily available outside of some videos on YouTube showcasing Oracle ADF. In the end, I was able to quickly build the application I desired using the Play! Framework. In a way, by not having my question answered I was able to find a solution that would prove to be a better fit for my needs; though I would have gladly bought a cookbook if someone had pointed one out.
Standard way of working on new API (library, class, whatever) usually looks like this:
you think about what methods would API user need
you implement API that you suspect user will need
So basically you trying to guess what your API should look like. It very often leads to over engineering stuff, huge APIs that you think user will need and it is very possible that great part of your code won't be used at all.
Some time ago, maybe few years even, I read some article that promoted writing client code first. I don't remember where I found it but author pointed out several advantages like better understanding how API will be used, what it should provide and what is basically obsolete. I think idea was that it goes along with SCRUM methodology and user stories but on implementation level.
Just out of curiosity for my latest private project I started not with actual API (some kind of toolkit library) but with client code that would use this API. Of course my code is all in red because classes, methods and properties does not exist and I can forget about help from intellisense but what I noticed is that after few days of coding my application "has" all basic functionalities and my library API "is" a lot smaller than I imagined when starting a project.
I don't say that if somebody took my library and started using it it wouldn't lack some features but I think it helped me to realize that my idea of this API was somewhat flawed because I usually try to cover all bases and provide methods "just in case". And sometimes it bites me badly because I made some stupid mistake in basic functions being more focused on code that somebody maybe would need.
So what I would like to ask you do you ever tried this approach when needed to create a new API and did it helped you? Is it some recognized technique that has a name?
So basically you're trying to guess what your API should look like.
And that's the biggest problem with designing anything this way: there should be no (well, minimal) guesswork in software design. Designing an API based on assumptions rather than actual information is dangerous, for several reasons:
It's directly counter to the principle of YAGNI: in order to get anything done, you have to assume what the user is going to need, with no information to back up those assumptions.
When you're done, and you finally get around to using your API, you'll invariably find that it sucks to use (poor user experience), because you weren't thinking about how the library is used (UX), you were thinking about what the library must do (features).
An API, by definition, is an interface for users (i.e., developers). Designing as anything else just makes for a bad design, without fail.
Writing sample code is like designing a GUI before writing the backend: a Good Thing. It forces you to think about user experience and practical effects of design decisions without getting bogged down in useless theorising and assumption.
And contrary to Gabriel's answer, this is not bottom-up design: it's top-down. Rather than design the concrete backend of your library and then force an abstract interface on top of it, you first design the interface and then worry about the implementation.
Generally speaking, the idea of designing the concrete first and abstracting from that afterwards is called bottom-up design. Test Driven Development uses similar principle to what you describe to support better design. Firstly you write a test, which is an use of code you are going to write afterwards. It is important to proceed stepwise, because you have to proove the API is implementable. IMportant part of each part is refactoring - this allows you design more concise API and reuse parts of your code.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a web based application which uses a JSON over HTTP based API to communicate between the server and the client. The goal being that multiple clients can be developed with different goals (online web client, offline desktop client, or third party created) using the same online data to be shared through this web service.
Right now the communication between the client and server is sent via POST only through a system that works well. I read quite a bit of information about REST and being RESTful with HTTP using PUT, GET, POST, and DELETE. I could separate my API into these different categories, but it means more code and some changes to the API.
My question is: how important is it for a HTTP based API be RESTful? Is it a recommendation, an option, or a near necessity?
Thanks in advance.
As a die-hard RESTafarian I'd say use HTTP (the REST protocol in question) to its full extent. Why? Well, I'll show you two snippets from an email exchange I had yesterday with a good friend of mine who's seriously clever (and used to be a professor of IT, still lectures, still kicks ass wherever he goes) ;
Yesterday I passed an important
milestone for my mappodrhom
application: I can now launch
long-running background computations
into a worker pool. When they finish,
the workers POST back their results
directly into the REST resources.
Which triggers more background
processing, all controlled by a
dependency graph.
And the interesting aspect is that
this RESTful backgrounding is
actually independent from my
particular application. But I am
currently too tired to completely
grasp the consequences :-)
The consequences in question are huge (it's a REST framework with lots of little stacks and events and services and apps, all with their own discoverable URIs, all with the same unified interface), and in terms of extensibility and scalability it is simply unmatched in its simplicity. If your application is a dinky little thing that will never travel places or meet hot chicks, yeah maybe you don't need it. But then, I've said the same, and all of a sudden found myself on a train to Paris with a cute girl that is a secret spy for the Russians, and well, one thing led to another...
Here's my reply, with some of my own experiences ;
I think this sounds (pardon my French)
f***ing awesome! I'm experiencing
similar things with my own REST stuff,
where because the middle layer is so
thin and transparent, I can just
extend things the way I need them
without worrying too much about the
infra-structure. It's such a freedom,
such a kick-ass cool thing that my
brain is about explode, and a
worrisome curiosity to why more aren't
doing it?
In short, doing REST only half-way is just like not really doing it at all. You're just shifting your stuff over a different pipeline, missing out on a simplified API into a state-machine, semantics- and implementation decoupling at the core, working with the principles that built the net (and hence I'd say you've got rather proven ideas behind you), the unified interface, and having URIs as part of your modeling.
I know it's popular to say that you can pick and choose, that it's all just options. It's not. REST only makes sense by using it fully, but as to convincing you to actually stretch your brain a bit further and do something clever, I can only dare you to cut through the FUD (that it's all about RPC, only GET and POST necessary, you don't need it all, equivalent to JSON, SOAP and other ilk, etc.), and be smarter about how you make applications. Yeah, I dare you all!
Unless you are going to take advantage of hypermedia then I wouldn't bother trying to conform to the REST constraints. Hypermedia is the piece of the puzzle that makes the system greater than the sum of its parts.
You are free to pick and choose which of the REST constraints you want to respect in your architecture, just note that to be able to call the end result RESTful, the only optional constraint is "code-download".
It's an option amongst several for exposing a web application as a web service with a well-defined API. Other options include:
No API - The application has no real way to be used as a component in other distributed systems
SOAP - An XML format for defining API remote calls
JSON - A compact format for information exchange that can be built on to create a custom API format (or used to build a REST system if you wanted)
Many other forms of remote procedure calls and information exchange mediums.
REST has a nice ideal behind it, but that doesn't mean you have to provide a REST API for your application. If the gain isn't worth the extra effort, don't bother.
It is a recommendation. I am glad you did not go into how RESTful you need to go into as there is something called Hi-Rest and Lo-REST. You can get more information from googling. Some industry veterans I know do not much care about this, but I do find staying as close to html and http will help you in the long run and simplifies many things.
I would submit that it's a nice to have but not a must. In my experience adding this architecture increases the scope and complexity of the project, but it does add a degree of elegance to the whole. I would say if you've got the time and budget on the project, go for it, if not don't worry about it.
One (of the many) things to consider with service API's is the ease in which they can be consumed by your end user. REST is gaining a very strong tooling presence.
By far the largest dev group out there is the .NET dev group, and with ADO.NET for services (Astoria) consuming REST using Linq is very simple and very elegant.