aspectroid
exploring the aspect-oriented design space
  • the project
  • the guy
  • resources
  • episodes
  • journal

An Exercise for Aspectroid 1 (Ribbons)

11/2/2014

 
While replying to a comment in the discussion group (concerning the implementation of a Ribbons-like app using the DCI approach), I proposed a change in behavior, because changing our software is an excellent way to learn about its real properties. 

The change was seemingly simple: while in the Ribbons app the Surface acts as both an input and an output panel (that is, you move your fingers on the Surface, and you draw on that same Surface), it would be interesting to see how hard it would be to separate input from output, that is, having an input Pad separated from an output Surface.

I tried the exercise myself, of course. I also wanted to explore a few more twists: Will simulated input keep working? What would it take to enable both the Pad and the Surface to act as inputs? More importantly, will it work with multiple, independent Pad + Surface pairs?

I started with something simple, that is, how would I like my XML layout to look like for two side-by-side Pad + Surface pairs (with each Pad under its corresponding Surface)? 
I concluded something like this was ok:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal">
 
<LinearLayout android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical">
 
<com.aspectroid.Surface android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#000000" />
 
<com.aspectroid.Pad android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#444444" />
 
</LinearLayout>
 
<LinearLayout android:layout_width="4dip" android:layout_height="fill_parent" android:orientation="vertical" android:background="#ffffff" />
 
<LinearLayout android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical">
 
<com.aspectroid.Surface android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#000000" />
 
<com.aspectroid.Pad android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#444444" />
 
</LinearLayout>
 
</LinearLayout>
  
So, ideally I would just create an empty Pad class, just like Surface is empty, and use aspects to wire everything up. In practice, it took me some thinking, and in the end, what I got suggested that I should probably rearrange some responsibilities in the original app!

So, here is a short video of this new behavior:
This is just a journal, however, so no code here, although it took just a few lines. While I warmly suggest that you try the exercise yourself :-), I'll probably add an appendix to the ebook and discuss this further. I'm a bit swamped these days (so Episode 2 is going to be late as well) but I'll catch up eventually :-).

    RSS Feed

    It takes a while to complete an Episode. It's not just about the writing, of course. It's about the research, the experiments, the thinking. 
    So while I'm here cooking, I thought I could let you guys know about any relevant progress. 

    Join the discussion group to help me shape the next Episode :-) 


    Archives

    July 2015
    March 2015
    January 2015
    November 2014
    September 2014

Powered by Create your own unique website with customizable templates.