question

pulse100 avatar image
pulse100 asked ·

Looking for advice to start Alexa programming, which language; Lambda use?

Hello folks, I have few ideas for Alexa programming and I am looking for advice. My goal is not simply a project for Hobby but I would like to commercialize some of these ideas and want to spend time in the right architecture/foundation etc. My background and questions are below. In case you are local in NYC / NJ area and would be open to a phone call/coffee would greatly appreciate your time.

My Background: - Used to be a Java programmer about 10 years back, since then moved to Project/Product roles. - Recently completed a basic Java/Android app. - Have a buddy to help in Python/Django based backend framework. Love Python myself. - I have reviewed few YouTube videos and udemy course on ASK.

My Questions: - with my Java/Python background will it be advisable to use Node.js for Alexa programming or start with what I know? The reason I ask that is most examples/tutorials i found are in Node.js? My own skill set is Java and little bit of Python. Is it worth it for me to learn Node in this case? If not which of the other two between Java and Python is better? - I dont have much background in Lambda. Should I consider using that service or a django/python backend with which I already have some experience? - Any other resources that you feel maybe useful.

I will greatly appreciate any advice.

alexa skills kitdebugginglambda
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered ·
I'm glad you are looking at doing more than a throwaway template skill. I would caution you to approach commercialization with realistic expectations. It is very difficult to do in the current environment. >with my Java/Python background will it be advisable to use Node.js for Alexa programming or start with what I know? Bottom line is to use what you are going to be most productive with. The languages and capabilities are similar enough that having a high skill in one language or another trumps the differences. That being said, Node.js was built for small, server based environments where non-blocking code was very important. The language has many features to make that easy. For Alexa skills that are small, one-shot invocations, it is not a bad match. For anything more serious, you start to get out of the sweet spot that node.js is good for. Python is, again, primarily aimed at server servicing environments. This is a pretty good match for the type of actions that a mid-range Alexa skill needs to do. Although people like that it is loosely typed and interpreted, the advantaged gained in "ease of programming" becomes a problem in deployment, as there are many types of mistakes that cannot be caught until runtime. If you take this route I recommend adopting an aggressive testing strategy. Java is a fully featured professional language, with all the bells, whistles, and copious libraries to do advanced programming. If you are considering doing a serious skill with advanced complexity, this would be a good language to choose. It's overkill for smaller skills though. Again, before the advocacy wars start, being really good at any language can overcome any of the structural shortcomings of that language. You can successfully develop in any of these languages (and many more). >most examples/tutorials i found are in Node.js Tutorials tend to be small and focused. As such, since node.js is good at small things, it tends to be used a lot for examples. In reality, if you are doing more than just a cut and paste template, you are only going spend about 10% of your time on Alexa specific stuff, and 90% of your code base is going to be the business logic of your skill. I wouldn't worry too much about the lack of examples. There are enough examples of the basics in each language. >I dont have much background in Lambda. >Should I consider using that service or a django/python backend with which I already have some experience? I would not do anything more than a trivial skill in Lambda. You have constrained by a time budget, and you cannot cache or multi-thread operations with Lambda. The only advantage to Lambda is that you don't have navigate the complex and error prone world of SSH certificates that is necessary to run your own server. Do not underestimate the time you will burn trying to configure your server to meet the exacting, yet vague, requirements that Amazon has for them. The middle ground is to run your own server, but proxy to it via Lambda. That requires no special set up of your server, and minimal knowledge of Lambda. >Any other resources that you feel maybe useful. Beating my own drum here... * I've written a book aimed at people who are new to Alexa, but not new to programming. You might find it useful, and it's only $0.99: https://www.amazon.com/How-Program-Amazon-Echo-Development-ebook/dp/B011J6AP26 * TsaTsaTzu has released a intermediate level template for a state machine driven skill in both node.js and Python under the Apache license, so it's open for people to use: http://ocean-of-storms.com/tsatsatzu/tsatsatzu-releases-finite-state-machine-template/ * TsaTsaTzu's submission for the hackster.io competition this month is a multi-player game that showcases many of the advanced techniques used in StarLanes, one of the most advanced skills on Alexa. This uses Java and is open for public observation over the course of the competition. When the competition is concluded the product will be published with the Apache license, and members of the community will be invited to contribute, take it over, clone it, or base their own advanced skills on it. https://github.com/jjaquinta/EchoSubWar Best of luck.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pulse100 avatar image
pulse100 answered ·
Thank you jjaquinta. In principle I agree with all your viewpoints. I am leaving it open to receive additional comments. One clarification for commercialization is that I am not necessarily looking at monetization but I want to productize my solution to have actual users using it. I have some background in Home Automation and have followed this space for about 15 years. Alexa and the possibility it offers is something I am quite excited about, especially in elder care and other technology challenged applications.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered ·
Other opinions are welcome and will, almost certainly, contrast with mine! :-) Given what you said, you might also consider joining the slack channel: https://amazonalexa.slack.com/messages/general/ One member @tteague also has an interest in using Alexa for elder care.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Michael Krautstrunk avatar image
Michael Krautstrunk answered ·
Forgive a basic question, but how does one sign in to the amazonalexa slack channel without an invitation? Thanks.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered ·
The original post said: >Hi all - I created Slack channels for Echo and AVS enthusiasts. >It's free and everyone can join at http://www.alexaslack.com. >Thanks, Maciej Maybe just the root url?
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tom avatar image
Tom answered ·
I'm an experienced C++ and Java developer that had the same questions a few weeks ago. In the end, I opted to start my ASK development with node because I had some problems getting started with Java and then noted that there seemed to be a lot more activity in node vs. Java. I also have concerns that Java is not well suited to lambda due to how long class-loading takes - I figure that probably balances the better speed of Java once it is loaded. I also have a lot more faith in the future of node & js - given their current trajectory - vs. Java now that it is owned by Oracle. It has been interesting learning js and node but I'm being reminded of how painful it can be to use a dynamic language (i've done some python before) when you are used to a static language - losing all the advantages of advanced refactoring and error checking! It really does amaze me that js & python are so popular. Maybe I'll switch back to Java - not sure.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered ·
>Java is not well suited to lambda due to how long class-loading takes Lambda has a time budget. But it also may recycle the JVM each time there is a call. So you can't expect the speed to be improved upon subsequent calls. I found the JVM expiration time to be a few seconds. Therefore you can't do multi-threading or caches. But I also did not find that the time spent was on loading classes. For me the time budget was most drained by reading from DynamoIO and writing back to it. And since you can't cache it, or put it on a background thread, that made Lambda a non-option for my skills. It wouldn't matter if I was using node.js or python. The problem is structural. >I also have a lot more faith in the future of node & js - given their current trajectory - vs. Java now that it is owned by Oracle. Moving off of Alexa into general programming... My day job currently involves a complex system with a constellation of small vms talking to each other over REST APIs. (Docker) We use Java, Python and Node.js in different ones of them, depending on what makes sense. My personal preference is for Java, as that is the most performant, robust, and error free. But there are times where it is just easier to spin up a node.js or flask (python) server rather than a whole web server that can host servlets. But as far as the industry goes, Oracle bought Java quite a while ago, and it really hasn't had much of an effect. My day-job-company (IBM, on whose behalf [i]I do not speak for[/i] in this forum) is a huge competitor of Oracle, but that hasn't dented their enormous investment in Java. So, my suggestion, FWIW, is to make your decision based on technical merits.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Galactoise avatar image
Galactoise answered ·
Have to agree with a lot of what jjaquinta put out there. My team's stack is also Java based (Dropwizard on EC2, Maven, etc). I couldn't imagine building out an entire non-trivial skill on Lambda. We do use Lambda for small things, like as a passthrough between Alexa and our service, but I wouldn't consider putting a full skill there. As a simple matter of volume there's a lot more node stuff because that's the way the tutorials have been published, but it's worth remembering that the vast majority of those people who built skills via the tutorial probably aren't continuing to be active in the development community. So, there's a tradeoff between quantity and quality, in that regard...
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tom avatar image
Tom answered ·
My negative experience with Java startup times was on App Engine, and was in comparison with Python. And from what I've read about Lambda, the same problem exists, now comparing Java to node. The disheartening thing was that it was a fairly high priority problem problem, and I think there are possible technical solutions (besides throwing a lot of resources at it), but Google server side Java support has been pretty much frozen for years, eg. servlet API 3 feature request was opened in 2010 and is still pending. Meanwhile, node v6 just came out with significant improvements in module load time though node was already much faster at loading then Java. So, maybe as you guys say, lambda simply isn't a good solution for any serious ASK project - I haven't gotten that far yet, and you clearly have - but I get the impression that Amazon wants it to be. And I think that GAE, which is roughly similar to Lambda, is good for serious development of the right type. I often had to use GAE backend modules which don't have a time limit, but that's to be expected - Lambda/GAE front-end modules are about quickly serving user requests and submitting requests for longer running tasks to be executed elsewhere. The only thing that I was able to forsee that would make lambda unsuitable for responded to user generated web or Alexa requests would be delays caused by unduly long startup time of fresh lambda instances - one of the reasons I opted not to use Java though I like it and already know it.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

genousnret avatar image
genousnret answered ·

is there a short answer

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.