Hello,

I'm Nikhil Peter Raj, a 3rd year Computer Science student at Manipal 
Institute of Technology,India.

I've been looking through the android source code and wanted to put my 
ideas across to see if they are feasable:

*1) Use a deserializer/serializer for parsing and processing JSON*

   - Currently, the JSON is set/get using the normal put() and get() 
   methods. I've found this to be very inefficient and cumbersome in the long 
   run, especially for nested json data like the kind the sage server 
   expects/replies.If we use a JSON deserialzer/serializer like GSON(
   https://code.google.com/p/google-gson/) or Jackson(
   https://github.com/FasterXML/jackson) we could simply write a class 
   which contains all the required fields and hence obtain a POJO for the 
   same, which would have all the required getter and setter methods plus the 
   utility methods for required operations. Additionally, GSON inserts null 
   into fields which are missing from the reply so the checking is trivial.
   - Also, this would make it easier to change migrate the code if the 
   reply/request format ever changes.
   
*2)Use an asynchronous http and websocket library*

   - The current http request reply is done through AsyncTask, which is 
   either buggy or unpredictable at the best of times.
   - Examples would be:
      - It behaves differently for pre 3.0 versions of android and post 3.0 
      versions.
      - AsyncTask cancel() is not guaranteed to actually cancel the request 
      & must be explicitly done by checking onCancel()
      - Running two AsyncTasks in sequence usually results in 
      unpredictable behavior due to above issue.
   - I personally would think it would be better to use something like 
   https://github.com/koush/ion for the http requests, I have used this 
   library in my projects and it is extremely fast and also supports built in 
   GSON decoding, which would reduce a lot of unnecessary code which is now in 
   doInBackground() 
   - Other alternatives would be to use Volley: 
   https://github.com/mcxiaoke/android-volley(GitHub mirror) which is now 
   used in a lot of Android projects as well as most of Google's official apps.
   - Also, I would suggest that the websocket library also be changed to 
   https://github.com/koush/android-websockets, it is based on the current 
   websocket library(more or less exactly the same with additional utility) 
   but is more up to date and favored(However since I have limited experience 
   in websockets, I do not know if this is viable ).

*3) Use a better WebView ?*

   - This unfortunately is the one part which is not really feasible at 
   current, since there are no WebView libraries which are comparable to the 
   officially bundled one.
   - Currently, Android 4.4 has a much better WebView based on the Chromium 
   Source which is better by leaps and bounds 
   https://www.timroes.de/2013/11/23/old-webview-vs-chromium-webview/ , but 
   again, this is currently only usable by apps running said Android version. 
   I will keep looking for alternatives but it is highly unlikely this is 
   possible at the moment.

*4) Use Charting Libraries where possible ?*

   - Some of the graphs to be drawn could be displayed using either 
   AChartEngine or AndroidPlot and hence reduce the dependency on WebView, 
   which is generally inferior across the whole range of devices.

*5)Detect calculations which are possible on device and avoid sending it to 
server*

   - Some of the simplest calculations(1+1,standard arithmetic etc) are 
   also processed via the server, which is frankly unnecessary. Would it be 
   possible to perform such computations on the device itself and avoid the 
   use of internet altogether ?
   - I understand that this would require a way to detect if the entered 
   code is actually something which can be computed locally, but I'm just 
   putting my ideas across.

*7)UI/UX Enhancement*

   - Currently, the app has a basic(but functional) UI which could be 
   improved upon using better layouts,listviews,use of Navigation 
   Drawer/Sliding Menus(if possible) etc.
   - Add a proper welcome screen.
   - Display the tutorials/manuals etc on the app itself,with code which is 
   more relevant to the Android app.
   - It is possible to add syntax highlighting to the entered code using 
   https://code.google.com/p/java-prettify/, however, this adds no real 
   functionality,error detection etc, but would be more user friendly. Once 
   again, this is a limitation of the Android TextView that it cannot syntax 
   highlight on the fly, and hence performance could be affected negatively.

*8) Misc cleanups and fixes*

   - Replace all string usages by constants or string resources.
   - Build all the URIs in a separate class using URI Builder, this would 
   again make it easier to change the urls if ever required.
   - Separate the code into packages having only the corresponding elements 
   viz. activity,fragments,adapters,ui etc for better readability.
   - Migrate completely to the gradle build system: Having used Eclipse for 
   over a year and dealing with its annoying problems, I can honestly say that 
   Android Studio is vastly better and the gradle build system more dev 
   friendly(include libraries directly from Maven Central etc), and would 
   wholeheartedly suggest that the app be rebuilt using gradle build system, 
   and it is very much likely that this will be the worldwide standard in the 
   coming years.

*Additional Queries*

   - Do you have a one/two patch rule as a selection criteria ?
   - Could I directly contact you with regards to queries/further ideas I 
   may have ?

I understand that many of the above may not be valid ideas, but if any of 
them are, advice and criticism are appreciated.

Thanks,
Nikhil

-- 
You received this message because you are subscribed to the Google Groups 
"sage-gsoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-gsoc.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to