-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
Marketing term for JSR223 scripting #443
Comments
Reply by @BClark09:
|
Reply by @steve-bate:
|
What do the others think? @smerschjohann @kaikreuzer @martinvw and others |
I do agree the current term is to technical so I would be happy with a correct but not to technical name 😄 |
My vote is on "Scripting for openHAB", I also agree with @steve-bate and think we should also allow people to add these scripts to a "scripts" directory as well as the jsr223 directory (for legacy). |
I like @BClark09's suggestion to follow "Scripting for the Java platform" and call it: |
This won't work as the "scripts" folder specifically ONLY accepts xtext scripts (i.e. "old" rule engine stuff, just like "rules" is only for Xtext rules. We already had a long discussion in January about that and the outcome was the I don't think that "Scripting for openHAB" is in any way specific enough. To me, it is the same as "programming for openHAB". It does not tell you what you actually do with it, i.e. in this case that it is about automation. |
More on the topic of the original question: I agree that jsr223 is very technical and I am fine with finding another term for it. But I think the right term might differ per topic that we want to describe. Looking at the Python examples, we are actually looking at programmed classes and not at all at scripts... |
I never understood during that discussion why it was so important to have only Xtext scripts in the scripts directory. I don't think having all scripts there would cause significant confusion for the users and could possibly be less confusing. I understand that there might be a technical issue with Xtext rules only being able to invoke Xtext scripts rather than any JSR223 scripts (not sure if that's true or not).
I think we need both types of documentation. We need general scripting documentation and application-specific documentation.
I understand your point, but most programmers understand the concept of scripts and we've already used that terminology for quite some time. Note that scripting doesn't require programmed classes. There is an example script in the documentation with no classes. Also, some scripting languages are compiled (Jython generates bytecode files). The primary difference I see with scripting is that there is much less programming and environment overhead. If a user wants to create a simple extension to openHAB, they don't need to know Java, OSGI, Maven, Thing APIs, Binding APIs, the Eclipse IDE and so on. Even for experienced Java programmers it is much easier if they already know how to program in one of the scripting languages. Again, we already use the "script" terminology and that term doesn't specify what will be done with the scripts. However, since the JSR223-related scripting functionality is not openHAB-specific, should we consider "Scripting for Eclipse SmartHome" instead? |
I think you did not really get my point, let me try to explain again: "Scripting" is after all just a technical term for "programming" - and in that way it is equally technical & unspecific as "jsr223". So yes, we can have a general section that covers the similarities (but this will mainly be the information on how to get the scripting language engines technically set up). For this, I would prefer a term like the suggested "Using (Other?) Scripting Languages". |
Based on this clarification I think I did understand. However, I have a very different perspective. Scripting is a kind of programming but that doesn't make "scripting" and "programming" synonymous terms. I would hope you would agree that almost all the existing openHAB functionality is implemented using programming tools and techniques that would not be considered "scripting" by practically anybody's definition of the term. Also, it's not particularly relevant but JSR223 is very specific. There are associated specifications and standardized APIs. The issue is that Java 9 platform will stop referring to the scripting APIs as JSR223 so the name will eventually become outdated.
JSR223 scripts can be called from rules (JSR223 rules at least, not sure about the NG rule engine) and has access to openHAB items and actions. It would be very easy to write a script to add a console handler for invoking scripts if someone needed that. The "linear piece of code" requirement seems to be the only real discriminator from your description. However, I'm guessing you really meant that a "script" is only the limited Xtext grammar supported by openHAB.
You're correct that JSR223 is not about the openHAB-specific Xtext "scripting" API but is about the more general and powerful Java platform scripting API. In my opinion, I'd prefer it if Xtext was just another JSR223 script language. It's fine if it's very limited capabilities. Other JSR223 languages also vary in their capabilities and degree of integration with the Java runtime. As for directories, I don't see as much value as you do in openHAB's rigid configuration directory structure. I could write pages on this topic alone, but I accept that you feel so strongly about it that you aren't likely to consider more flexible alternatives. That said, I don't care if we continue with the
I'm fine with that too. |
So what would you call a binding implemented in Jython through JSR223 then? Is it scripted or programmed?
No, definitely not if this "jsr223 script" is a binding or a rule module type handler.
So you mean it would be better to have a single "conf" folder where people can throw in anything they like (rules, add-on configurations, item files, etc.)? I indeed prefer it a bit more sorted, so that the parsers know where to look for files and not only rely on file extensions and content.
As said above, I am fully with you that jsr223 is very technical and not the best term for end users and I am open for better alternatives. I could imagine that we instead use |
Yes. Either answer is correct. Scripting is a subcategory of programming, not synonymous with it. The artifacts created by the script (like a binding) seems to me to be irrelevant to the question.
I should have been more precise. The artifacts created by a JSR223 script can be used (or called) from scripted rules (which are just another artifact). This includes abstract bindings or rule module type handlers. For example, a rule could trigger from an event, use the event data to subclass an abstract binding implementation (defined in another script) and register an instance of the new binding class as an OSGi service.
No, that's not what I meant although a flexible file loader would allow that approach if that's what worked best for a specific user. For me personally, I'd like to be able to organize openHAB file artifacts so that a subdirectory could contain all the files for a specific automation purpose. For example, if I add support for a device or a function, like presence detection, I'd like to have the items, rules, scripts, transforms and so on for that functionality located together rather than spread across several directories.
I'm not sure how to respond to this because looking for files sounds more like a file watcher responsibility than one for a parser. In JSR223, once of a script has been detected the A script can define multiple kinds of artifacts. It could define rules, items, transforms, functions, classes, bindings, module handlers, console commands or whatever in a single script. A directory structure that assumes a single kind of artifact in each script wouldn't work well for a script like that. Likewise, a directory structure that forces a single file extension per directory wouldn't be necessary or desirable (in my opinion). We need one or more JSR223-related directory hierarchies, ideally configurable, for the file watchers to watch but beyond that I think we should not constrain the scripting directory structure any further unless there is a clear technical benefit. |
I think I start seeing where the confusion comes from. You seem to think about jsr223 scripts as "code that is added to the classpath", so similar as (compiled) Java code can be thrown into "add-ons", you would want a folder (tree) where you can put any kind of scripted code. What you are missing here is that openHAB is not a monolithic Java application, but that it is highly modular and different parts of its code are isolated from each other (by having different classpaths). Of course one could say that we could define a "master" script loader that puts all scripts on the boot classpath and makes available all services in the scope. But this would fully spoil the openHAB architecture, leading to security issues, stability issues and probably many further unforeseen problems. |
If I'm missing something, it's not that. I understand OSGi class path behavior and Java class loaders in general.
Not true. The Jython scripts can define services for those types of components and register them with OSGi using the bundle context of the JSR223 script loader. Take a look at my GitHub repo for several examples. Although the components are currently defined in separate scripts, they are all loaded by the same script loader with the same OSGi class path. There should be no issue with combining them into one script, if I wanted (which I don't). This does not require all scripts to be on the boot class path. Furthermore, in the scripts I can create custom class loaders to extend the class path and, if needed, I can query for existing OSGi services and use their classpath to load classes that are not on the JSR223 API class path.
The |
We have significant changes for the whole rule/scripting area of openHAB, so this does not fit anymore. |
Continuing from #428
The text was updated successfully, but these errors were encountered: