
An un-poetic ode to IntelliJ. Will be amended continuously.
You type ‘iter’ and you get a live template:
for each (var object:Object in myColl) {
}
And a caret over ‘myColl’ letting you pick from accessable itterable types.
Nice!
Now if only it recognised 0xfefefe as well.
So I started a little plugin a few days ago. I’m writing it for IntelliJ and it’s designed to make your life a little simpler, letting you navigate between classes with known ‘Up’ and ‘Down’ relationships in Robotlegs MVCS. Eg, The view is “Up” from the mediator and the service is “Down” from a command.
Apart from finding great little timesavers all the time, this is my first exposure to the underlying code of IntelliJ. It looks a little ‘patternitis’ but everything makes sense, and even the closed source ‘JavaScript’ plugin was easy enough to take advantage of with just headers.
It’s also my first time into Java, and the experience has been made sweet because:
I mean the Javadocs are ancient and out of date, and some things are clearly legacy, and yet me, a n00b Java programmer had no trouble cobbling together the first part of the Robotlegs plugin.
Here: http://plugins.intellij.net/plugin/?idea&id=4685 which means it’s also available in your IDE.
You may need the EAP version of IntelliJ as that is what I coded against.
It only does one thing right now. If you are in a mediator, then Ctrl-Alt-PageUp will take you to the linked in view. There is a roadmap here and all the source is here
All the design is in place and a lot of the ‘discovery’ is done. So things should fall into place. Let me know if you have any trouble with it.
Rash wanted to mount a shared folder between his Windows desktop and a Linux guest running inside Virtual Box on said desktop.
He also wanted to be able to own and write to the mounted shared folder as himself, ( aka non-root user).
The syntax to put into /etc/fstab is:
[shared folder name] [mount path] vboxsf uid=[uid],gid=[gid],dmode=0755,fmode=0755 0 0
In Rash’s case this was:
Documents /home/rasheed/host_documents vboxsf uid=1000,gid=1000,dmode=0755,fmode=0755 0 0
Then, mount it:
sudo mount /home/rasheed/host_documents
VisFleet sponsored the Flash Platform Users Group lastnight. Thanks to the guys and girls of the group for a good night and interesting talks.
And here’s some pics:

Rash taming Flash code into crafted code

Vinnie wowing the audience with 3D in the browser

VisFleet are sponsoring the next Flash Platform User Group meeting this Thursday @ 6PM at VisFleet’s offices. Our own Rasheed is giving a talk on the popular new Flex framework (RobotLegs).
To register, RSVP here:
http://aucknzfpug.eventbrite.com/
All welcome. Pizza and beer will be provided. Should be a good night.
Talks:
Rasheed Abdul-aziz. Rasheed will be wowing us with the wonders of the new framework RobotLegs. Robotlegs is a pure AS3 micro-architecture (framework) with a light footprint and limited scope. Simply put, Robotlegs is there to help you wire your objects together. (Sounds perfect)
Vinnie Vivace. Lately Vinnie has been twittering from the land of 3d and will be showing us a little more about Away3D Lite, a fast and small 3d engine.
EDIT: Stupid post. I don’t know how I got it into my head that VO’s needed an abstract factory for testing. They’re Value Objects! Without the Abs-Fac we don’t need ‘IVO’ and we can implement multiple interfaces because the concrete interface is all that our system needs. Sorry if I wasted your time with this drivel.
I’m currently looking at our services and model tier architectures. I’m focusing right now on the most common requirement of the client model-service tiers at Visfleet:
- Maintain a client side representation of collection resources (Lists of like information)
- Keep the list server-canonical (allow the server to provide the most up-to-date state as often as possible)
- Expose standard REST operations for List, Show, Update, Create, Delete, New, Edit
- Expose resource specific methods (RPC when needed)
So I was looking for a prescription, that as usual, kept my responsibility-count-per-class down near one.
What follows is my first draft. (Embiggen)

Note: IUpdateable is the only non-metaclass in this diagram.
So in this example I support service.load() which fetches the state of the whole list, or part of the list, from the server. The description of sequence that follows works as easily for any service request that results in a result record coming back from the server.
Typical Robotlegs behaviour here:
The list model needs to ensure that its representation of the list is updated by the incoming payload
To update a VO, listModel depends on IVO being IUpdateable. This could be a responsibility of the ListModel itself, I’m still not sure which is more OO Savvy.
In my opinion, a broadly updateable VO is a requirement of the Flex framework. Collection types in Flex work best if VO object references don’t change. So do the collection-aware components.
Usually at this point, someone wants to edit a VO. We don’t modify server-canonical VO’s in our apps, we clone them. We edit the clone, and actually share the clone as an ‘EditableModel’ so our whole app has access to the current VO under edit.
This is a perfect arrangement, however, I’m stuck. Making IVO ICloneable is not possible, I could only make VO ICloneable. If i move the IUpdateable respnsibility to ListModel there’s now a gap for ICloneable, but I’m not pleased with making an unassociated refactor a requirement.
If I introduce my EditModel at this point however, I do get a way around this that makes sense.
(Embiggen)

I’ve dropped some components to make this clearer.
EditModel is introduced. It maintains the currently ‘under edit’ VO which is a clone. It uses ICloneable a little like a marker interface to do this. However it does require the VO to implement clone().
Do you think I should be making the effort to make ICloneable purely a marker and have a CloneStrategy?
Please feel free to comment, once you are aware of my usual disclaimers
There are now Caveats to all my posts.
I am considering everything in this post from the point of view of a N-Tier RIA developer’s point of view.
The Robotlegs MVCS presents a myriad of ways you can work with your tiers, without adding one line of extra framework code or departing from the Best Practices. Then there are the few presentation model mods I’ve seen around, such as Elad Elrom’s.
I quite like the “Robotlegs is the presentation model” one we use at Visfleet. Below, I give a little bit of backstory and explain why I like it so.
I find that the original beauty of MVC is somewhat lost in most breakdowns of MVC-like architectures. I have to wonder if I’m missing something.
Originally the “View” of MVC was a Component, The original SmallTalk MVC was component oriented. From Fowler’s UI Architecture Article:
At this point I should stress that there’s not just one view and controller, you have a view-controller pair for each element of the screen, each of the controls and the screen as a whole.
There are reasons this approach died off and isn’t considered practical. Noteably, when the components are generic (yay re-use) and encapsulate their own modelling. For example, a checkbox has it’s own selection state and transition modelling. All you get as a consumer is a public interface (on the “View” no less) consisting of properties (e.g.: checked), methods and signals (e.g.:VALUE_COMMIT).
However there is a beauty to the idea of having control/model support for these component views in your MVC-like architecture. This is something I’m a proponent of. Verbs like “select”, “move”, “reorient”, “announce”, “publish”, “change”, “commit”, “save” etc can all become adjectives of state: “Jobs[1] is selected”, “task is running”, “person is facing east”.
I consider a lot of what most would call ‘view state’ (something kept by view, mediator or presenter) is in fact domain modelling.
Again from Fowler’s UI Architecture Article:
The idea behind Separated Presentation is to make a clear division between domain objects that model our perception of the real world, and presentation objects that are the GUI elements we see on the screen. Domain objects should be completely self contained and work without reference to the presentation, they should also be able to support multiple presentations, possibly simultaneously.
I worry that the domain modelling found in the client-tier of most N-Tier applications (read database backed with a server encapsulating business logic) is often treated as a model of the business logic.
Certainly there is a good case to model some business logic in the client for speed and responsiveness, networks aren’t terribly fast compared to my computer’s bus. However that “business logic” being modelled is actually a part of the client domain model. It should be considered a utility and not actual Business Domain Modelling.
Let’s reiterrate that through example.
The business tier (server) says that:
When enforced on the business tier, this is “Business Logic” or “Business Domain Modelling”
When mimicked in the client tier, this is “Client Domain Modelling”. It is not:
Client Domain Models in N-Tier application clients are there to serve the purpose of presenting the business to the user
What I take away from this is:
To put it another way, I see my whole Robotlegs MVCS stack as one giant ‘Presentation Model’
What a lot of people do in their presenters and mediators is have a local state and message bus. This feels awkward to me. Suddenly I’m without a prescription, and frankly it’s really easy for me to write crap again. I can fill my mediator or presenter with awkward code that unsuprisingly is often best served by the MVC pattern.
I could treat my mediator as the context for another Robotlegs stack, however there is one clear drawback to this: Views, with their own concerns, cannot change containment easily. I explain this with the “Doorbell Model” later.
Or most of them… There’s lots of good reasons to use subcontexts, but within a context, I want to use a single MVCS 4-Tier.
I mediate as many components as I can, it gives me some of the elegance that the original MVC had. Each component action is mapped to a command, the command changes state in my modelling in some way, the mediator and view ensure they represent the new state. Again, I’ll outline this in the “Doorbell Model”
If I want to ‘genericise’ a component, and thus limit other users to it’s view’s public interface (as with most UIComponents), then I still create a robotlegs 4-tier stack and pass in dependencies via the view’s public interface. Then the context for the component uses these values as injection mappings (often named value mappings). I don’t do this very often mind you, a single context doesn’t cause me any real pain. Sub contexts might make for less clutter and I look forward to investigating those further.
A simple analogy for why I don’t want any more tiers than the 4 in MVCS.
I’ve seen Doorbells on Doors, on the Wall beside Doors , and even at the back of a House (for a teenage boy’s mates to ring late in the evening.)
My original design might call for the Doorbell to be beside the frontDoor, thus contained by the frontWall, in turn contained by the house.
This frontDoorBell could be mediated by House’ or Door’s mediator. But why? Why not put a mediator on DoorBell. Then when I go to put a DoorBell on the backWall, and move the frontDoorBell to the frontDoor itself, nothing needs to change.
I almost imagine the DoorBell’s mediator to be a little circuit that hooks it to the wire on the House’ event bus.
Did you notice the arrival of the DoorBell on the backWall. This puppy makes it interesting. The event bus wants to ring two different bells, one for the teenageKidsRoom.bell and one for the hallway.bell. How would we identify the messages coming from these objects? That’s easy, the parent container of the DoorBell can inform it of it’s location (or the doorbell could ask the parent, it’s not an issue we need to care about right now).
The DoorBell.location property can be used to identify it’s position within views. This is appropriate intimacy and requires nothing but an obvious refactor to introduce it.
This approach to architecting my UI means that I have a proliferation of class definitions, and all within the convention of /model /view /controller /events /service. That’s OK. I compartmentalise component of the system by namespaces. Take a look at our namespace-prescription (living document) for Visfleet’s vWork product.
If you think I need to clear up anything or ammend anything or consider something, please comment. I crave peer input :)
I’m not saying verbose should be a dirty word, just that it does have a pejorative meaning. If you’ve used *nix command line tools often enough, you’ll know that -v is often used as a flag for “verbose”. This usually ends up in some useful information coming out of the log or stdout. -vvv usually means “very verbose” and too much information pours out to be of any use. And this is the risk:
If verbose is your end-goal, then the more verbose you are, the better.
Right? I mean that makes sense. If “quality” is your end-goal, then more and more quality is a thing to strive for. Same goes for “agile”, “fair”, “loyal”, “just”. All these words suggest that the more you pile it on, the better. This is not true of verbose. Keep getting verbose, and in fact, you just get more noise.
I’m probably nitpicking this to death, but I’m only doing so, now, because I think I have a better quality to strive for:
Really in our code, we wan’t to be more expressive. We want every line we read to convey it’s meaning.
If you check out expressive at dictionary.com there’s also a nice set of synonyms:
Synonyms: These adjectives mean effectively conveying a feeling, idea, or mood: an expressive gesture; an eloquent speech; a meaningful look; a significant smile.
I think eloquent is a good word too, it usually conveys meaning in a terse manner. That’s right, less verbose, just enough meaning and no more.
This code is readable, but not expressive:
public class EmployeeModel {
....
public function save():void {
if ((editingEmployee.name.length > 0) && (employees.checkUnique(editingEmployee.ssid))) {
employees.comit(editingEmployee);
}
}
...
}
So now I refactor it.
public class EmployeeModel {
....
protected function employeeIsValid(employee:EmployeeVO):Boolean {
return ((employee.name.length > 0) && employees.checkUnique(employee.ssid))
}
public function save():void {
if (!employeeIsValid(editingEmployee)
return;
employees.comit(editingEmployee);
}
...
}
I use a guard clause for starters because they convey intent more clearly.
Then I extract the method (all praise ctrl-alt-m in IntelliJ IDEA) employeeIsValid(). This gives the guard more meaning, and also gives the extracted condition more meaning. It’s a win-win.
Now, is this the following code more expressive or more verbose?
public class EmployeeModel {
....
protected function employeeNameIsValid(employee:EmployeeVO):Boolean {
return employee.name.length > 0;
}
protected function employeeIsValid(employee:EmployeeVO):Boolean {
return (employeeNameIsValid(employee) && employees.checkUnique(employee.ssid))
}
public function save():void {
if (!employeeIsValid(editingEmployee)
return;
employees.comit(editingEmployee);
}
...
}
I extract the name comparison (pretend for a moment that it couldn’t be done in the VO) - employeeNameIsValid().
This is not too bad, I think. It expresses that an employeeName that’s greater than 0 chars long is valid.
However this is easily inferred from the previous example, because the test is inside ‘employeeIsValid’ - It would read just as well, and so I wouldn’t bother with this extra step. At least, not until it got more complex. Remember, most refactorings are bidirectional.
I encountered three problems installing the Postgres ruby gem (pg) when using Bundler to install all the gems for a project on my OSX Snow Leopard 10.6 machine.
Firstly, the gem fails to build on Snow Leopard when you use the binary version of Postgres that is distributed by Enterprise DB. To work around this, the Postgres binaires need to be installed using Mac Ports.
Secondly, the pg gem must be installed using additional bash environment variables.
Thirdly, every time you run bundle install, the current version of Bundler hard re-installs all gems listed in ./Gemfile. This means that even if you install the pg gem correctly by hand, bundler will still try to reinstall it.
All three are resolved as below, in my case I am using Postgres 8.4.
Install postgres from Mac Ports
sudo port install postgres84
Include the postgres binaries in the PATH environment variable
export PATH=/opt/local/lib/postgresql84/bin:${PATH}
Then run bundle install with the all-important arch flag
env ARCHFLAGS="-arch x86_64" bundle install
Edit: removed sudo from bundle command.
© 2010 - VisFleet Ltd
No prawns were harmed in
the making of this website
Comments