Skip to main content

The domain

Note: Blogger is probably gonna mess up the styles in this post pretty bad, so forgive me if I re-post a couple o' times. View the original post if the feed item is garbled.

I've figured I need to get rolling on the example/reference case for the Action Domain Object-talk.

After some long and hard pondering I drifted away from the insurance domain and into something far more web 2'ish: an online community site.

I'm gonna call it The Universe. It's pretty simple, facebook'ish application that includes Worlds, Groups, Rooms and People.



Some cases:

  • The Universe can crud (save, browse and delete) Worlds
  • A World can crud Groups , Rooms and People
  • A Group/Room can add/remove People (members)
  • (or a Person can join/part Rooms and Groups)
  • A Person can send messages to People or Rooms
  • A Room is like a chat-room, as opposed to Group which is a more permanent organization of People
These 6 different entities are my Action Domain Objects.

It does have some complexing features, like a bunch of many-to-many relations, and plenty of alternative ways to implement the domain model, i.e. which entity is responsible for sending messages, manage People, etc.

Now, this wouldn't be any fun to implement without some restricting rules making it hard for me:

No Services and DAOs, only (a few) aspects/interceptors.

It will be implemented in Java.

Only one file/class per entity.

Operations should be RESTable.

They should be executable from a console application.

No XML (!).


So, then I started thinking about some URLs. Thinking URLs are a great way of getting an elegant web application. You get re-usable action chunks (cause you start thinking of atomial simple operations) and pretty URLs.

Let's trigger some operations:

Behold, The Universe:
/universe/browse
Create a World in the Universe:
/universe/worlds/create?name=earth
Next, create a Group in The newly created World:
/universe/worlds/earth/groups/create?name=developers
Create a person:
/universe/worlds/earth/people/create?name=ferris

Oh, I just discovered I need a couple of other entities to represent relations between People, Groups and Rooms. I'll use memberships for Groups and visits for Rooms.

Add me to the developer group (I'll skip the /universe/worlds/earth/ from this point):
.../memberships/create?member=ferris&group=developers
Later on, I log in:
.../members/ferris/login?password=postit
And join the chat-room "hackers":
.../visits/create?visitor=ferris&room=hackers
Send a message to the hackers-room, oh copy to John by the way:
.../messages/create?subject=Hey&sender=ferris&receipients=hackers;john

Right, think the idea is starting to come through. Now it's getting a bit late so I'll think I'll have to leave it like that. These URLs are very much subject to change, and if anyone can see any pitfalls I'm running in to, please comment.

Next week I'm gonna figure out whether I'm gonna make this happen with Grails or Struts2, or some other technology.


The following have been the inspirations to this post:

Comments

Popular posts from this blog

Open source CMS evaluations

I have now seen three more or less serious open source CMS reviews. First guy to hit the field was Matt Raible ( 1 2 3 4 ), ending up with Drupal , Joomla , Magnolia , OpenCms and MeshCMS being runner-ups. Then there is OpenAdvantage that tries out a handful ( Drupal , Exponent CMS , Lenya , Mambo , and Silva ), including Plone which they use for their own site (funny/annoying that the entire site has no RSS-feeds, nor is it possible to comment on the articles), following Matt's approach by exluding many CMS that seem not to fit the criteria. It is somewhat strange that OpenAdvantage cuts away Magnolia because it "Requires J2EE server; difficult to install and configure; more of a framework than CMS", and proceed to include Apache Lenya in the full evaluation. Magnolia does not require a J2EE server. It runs on Tomcat just like Lenya does (maybe it's an idea to bundle Magnolia with Jetty to make it seem more lightweight). I'm still sure that OpenAdvant

Managing dot-files with vcsh and myrepos

Say I want to get my dot-files out on a new computer. Here's what I do: # install vcsh & myrepos via apt/brew/etc vcsh clone https://github.com/tfnico/config-mr.git mr mr update Done! All dot-files are ready to use and in place. No deploy command, no linking up symlinks to the files . No checking/out in my entire home directory as a Git repository. Yet, all my dot-files are neatly kept in fine-grained repositories, and any changes I make are immediately ready to be committed: config-atom.git     -> ~/.atom/* config-mr.git     -> ~/.mrconfig     -> ~/.config/mr/* config-tmuxinator.git       -> ~/.tmuxinator/* config-vim.git     -> ~/.vimrc     -> ~/.vim/* config-bin.git        -> ~/bin/* config-git.git               -> ~/.gitconfig config-tmux.git       -> ~/.tmux.conf     config-zsh.git     -> ~/.zshrc How can this be? The key here is to use vcsh to keep track of your dot-files, and its partner myrepos/mr for o

Leaving eyeo

Thirteen blog posts later, this one notes my departure from eyeo after 4 years and 3 months. I joined eyeo around the headcount of 80 employees, and now I think there's just over 250 people there. My role coming in was as operations manager, doing a mix of infrastructure engineering and technical project management. I later on took on organizational development to help the company deal with its growing pains . We introduced cross-functional teams, departments (kind of like guilds), new leadership structures, goal-setting frameworks, onboarding processes and career frameworks.  And all of this in a rapidly growing distributed company. I'm proud and happy that for a long time I knew every employee by name and got to meet every single new-hire through training them on company structure and processes.  At some point, we had enough experienced leaders and organizational developers that I could zoom back in on working in one team, consulting them on  Git and continuous integration

Git Stash Blooper (Could not restore untracked files from stash)

The other day I accidentally did a git stash -a , which means it stashes *everything*, including ignored output files (target, build, classes, etc). Ooooops.. What I meant to do was git stash -u , meaning stash modifications plus untracked new files. Anyhows, I ended up with a big fat stash I couldn't get back out. Each time I tried, I got something like this: .../target/temp/dozer.jar already exists, no checkout .../target/temp/core.jar already exists, no checkout .../target/temp/joda-time.jar already exists, no checkout .../target/foo.war already exists, no checkout Could not restore untracked files from stash No matter how I tried checking out different revisions (like the one where I actually made the stash), or using --force, I got the same error. Now these were one of those "keep cool for a second, there's a git way to fix this"situation. I figured: A stash is basically a commit. If we look at my recent commits using   git log --graph --

Using Voice-Chat for Gamers in Distributed Teams

This is a post going into the usefulness of live voice-chat tools in distributed teams. If you've ever seen the Leeeeeroooooyy Jeeeenkiiins video of World of Warcraft fame, you've heard this kind of tool in action. It's how the participants in the video are speaking with each other - this is not a feature built into the World of Warcraft game - it's a separate team-oriented VoIP software, and it's all about letting gamers communicate orally while gaming.  Since these tools are for gamers, they have to be fast (low latency) light (as not to steal CPU-cycles from heavy games graphics)  moderate in bandwidth usage (as not to affect the game server connection) There are several options around: TeamSpeak , Ventrilo , more recently the massively grown Discord , and finally Mumble , which is the open-source alternative of the gang. A few years ago, when I joined eyeo (a distributed company), several of the operations team were avid gamers, and had a TeamSp