Jasonette / JASONETTE-Android

📡 Native App over HTTP, on Android
https://www.jasonette.com
Other
1.6k stars 270 forks source link

Idea: Jasonette Builder #62

Open proverbial-ninja opened 7 years ago

proverbial-ninja commented 7 years ago

I've been thinking abi about json builder for jasonette.

The idea is basically using blockly custom blocks to generate the json.

Just throwing this out here in case anyone has a better idea or maybe working on it or something similar and maybe get some feedback before i start (in like 2 weeks)

sg02 commented 7 years ago

Cool idea basically!

I'm wondering whether not a web version, but only android version, do you think?

If view frames and styles were made as a local file in android or ios, it would be cool! But net info (delivered by through href) should be somewhere for server-side, I guess.

gliechtenstein commented 7 years ago

@kmarima It's early days for Jasonette so I encourage any types of integration.

I think there will be all kinds of cool tech that make total sense for Jasonette, but we won't know until we try!

j2l commented 7 years ago

IMHO silex with a modified json generator for jasonette could be the way to go.

maks commented 7 years ago

@gliechtenstein I've stumbled across an example from what react-native has that is very close to what I have in mind with the builder app I started working on:

react-native-inspector

They use it as a read-only inspection tool, what i have in mind is that overlay also having a set of editing controls for all properties of the jasonette component that was touched, as well as showing the style applied to the component and the json tree its in, like the info displayed by the react-native inspector. This would allow in-place editing of the jasonette json tree in quite a visual way.

So perhaps rather than making the "builder" a module within the jasonette-android repo as I initially did, Jasonette-android could become a aar library that can then be included in other apps. This would be a different approach to the one you've so far taken with the JEM, as this would allow anyone to use jasonette along with any other "addon" libraries. This is the approach taken by many other libraries for java & android where you have a core library and then a number of optional libraries that you pull in via maven dependencies in your gradle config.

gliechtenstein commented 7 years ago

@maks There are two parts for this proposition:

  1. Turn Jasonette into an AAR library
  2. Use the AAR approach to implement Jasonette Extensions

1. Turn Jasonette into an AAR library

First, as for "Turn Jasonette into an AAR library" => I am totally a fan of this idea, as long as it doesn't complicate the regular experience. I agree it would be really cool if there's an easy way to import Jasonette into any existing app.

I kind of attempted to do something like this here http://docs.jasonette.com/advanced/#integration but as you can see it's not really user friendly and it's only for iOS. It would be great if it's just a matter of including a pod Jasonette to the Podfile (for iOS) or compile 'com.jasonette:jasonette' to the build.gradle file (for Android)

So if you would like to try that I totally support that endeavor.

2. Use the AAR approach to implement Jasonette Extensions

This is a bit tricky. As I discuss here http://docs.jasonette.com/advanced/#extension-vs-integration , each has its own pros and cons. I think an "extension" approach is much more powerful than just an integration into an existing project, because "extension" means you're extending Jasonette, so you can build your entire app using JSON, whereas "integration" means you'll end up writing native code for some parts of your app and use Jasonette for the rest, which is not as ideal as the "extension" approach.

Also, imagine this scenario: you want to quickly integrate google analytics, websockets, QR code, etc. modules altogether into your app. If we take the extension approach, everything is centered around Jasonette and all you need to do is:

  1. Specify these Jasonette extensions
  2. Use them with JSON markup just like the rest of Jasonette

If you were to do this in an "integration" approach, you would be importing Jasonette into your project, where you will have to implement all the google analytics, websockets, and QR code logic on your own, natively, and you won't be able to control them using JSON.

TLDR: Jasonette AAR sounds great! But I think extending Jasonette is more scalable and powerful than integrating Jasonette into existing projects. Hope this makes sense!

maks commented 7 years ago

Yes you're right @gliechtenstein its good to deal with each part of this separately.

  1. Great! I'll work on this. I want to make this easy too, so yes I want it to be as simple as adding a compile 'com.jasonette:jasonette' on the Android side and sounds like there is very simliar thing with pods for iOS.

  2. Yes, the extension approach is what I had in mind when I think "integration" :-) Definitely commonly useful functionality I want to see as aars or even standalone classes the way of you have them for JEM, I think both approaches make sense alongside each other. Actually with "integration" the main use case I see would be existing apps where I'd want to start using Jasonette in 1 or more Activities without committing to having to rewrite the whole existing codebase in Jasonette from scratch.

I think we are in agreement here on both counts, I'll get started building.