Hodges' Model: Welcome to the QUAD: Ruby

Hodges' model is a conceptual framework to support reflection and critical thinking. Situated, the model can help integrate all disciplines (academic and professional). Amid news items, are posts that illustrate the scope and application of the model. A bibliography and A4 template are provided in the sidebar. Welcome to the QUAD ...

Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts

Tuesday, December 17, 2024

NURSING -:- INFOTECH - worlds apart? Software testing

Another draft from over a decade ago ... duly revisited and updated:


https://www.statista.com/statistics/793628/worldwide-developer-survey-most-used-languages/

Reading up on Ruby and Rails and attending Scotland on Rails, I've been struck by the emphasis on testing. Testing in this context is about reliable software and building this into the 'product' from the outset. A book on Rails gets criticized because it leaves the chapter on 'Testing' until the end (even if the authors had their reasons - as they explained).

This take on testing is sufficient if (of course) it is appropriate and it is applied (as per the manual) to the application concerned. There are other more formal methods that extend to writing a specification for code which entails the use of formal specification languages such as Zed (as encountered in BA(Hons.) studies. This arises in situations were software is being developed for safety-critical situations. Clearly, robotic surgery, nuclear energy, and keeping an aircraft in the sky, take-off and landing are mission-critical. In the latter case a company is still dealing with life threatening loss of life that can follow, should the software system fail or more covertly introduce an error.

Reading about Rails, there are specific tests and these are provided as a result of scaffolding, a process whereby the bones of a web application are created within the Rails framework: with tests.

Rails creates a test directory for you as soon as you create a Rails project using bin/rails new application_name. If you list the contents of this directory then you will see:

$ ls -F test
application_system_test_case.rb  controllers/                     helpers/                         mailers/                         system/                          fixtures/                        integration/                     models/                          test_helper.rb
Source: https://guides.rubyonrails.org/testing.html

Rails uses a popular convention to organise and integrate the elements of a web application that includes a database, and dynamic interface. The approach is known as:

Models, Views and Controllers - MVC

MVC underpins several programming languages and frameworks. As displayed above, the tests that Rails creates have specific names and you can quickly see where they come from and how they encompass Rails (an essential property of course).

Today, I still wonder [ what's new! 😉 ] what is the equivalent to MVC in nursing? Models seems to fit! Over the years at many IT events, you can't help but reflect on nursing and its 'API' - application programming interface. Worryingly, in humanistic terms there is an instrumental potential in Hodges' model. If Nursing on Rails was a thing, what would the tests look like? Identity would be a feature, to demonstrate person-centredness, safety in medication and other treatment procedures. Is there a way to demonstrate the integration of care, and for a patient - the extent of holistic bandwidth? Of course, nursing comprises just a part of a clinical information system. It must be in sync in accord with other disciplines, medical and pharmacy and other multidisciplinary team members and yet ensure that 'nursing is visible'.

Previously: API : 'Waste not - want not'

Thursday, March 10, 2016

The Scope of Nursing::And other things

individual
|
INTERPERSONAL : SCIENCES
humanistic ---------------------------------------  mechanistic
SOCIOLOGY : POLITICAL
|
group

"Scope Resolution Operator (::) 
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
When referencing these items from outside the class definition, use the name of the class.
As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self, parent and static). 
Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 (which powers PHP 3), that's what the Zend team decided to call it. It actually does mean double-colon - in Hebrew!"
Source: http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php 

Scope of Nursing: (Interpersonal, Sciences, Sociology, Political & Spiritual)  actions, procedures, responsibility, accountability, governance, whistle-blowing, transparency, competency, candour, quality, safety....

Self-care?

Spot image: http://iridia.ulb.ac.be/~cpinciroli/extra/h-414/one_spot.png

Thursday, July 16, 2015

(Care) Finance (ta.....) Safety (taint..) Quality (tainted)

individual
|
INTERPERSONAL : SCIENCES
humanistic --------------------------------------- mechanistic
SOCIOLOGY : POLITICAL
|
group

"There are two parts to the security system. The first is a mechanism for distinguishing safe data from untrusted, or tainted, data. ... Importantly, taintedness is contagious, so objects derived from tainted objects are also tainted." p.409.







"There is a risk the Care Quality Commission's new responsibility for rating hospital's efficiency could "taint" its focus on quality, senior health policy experts have warned." p.5.




Flanagan, D. & Matsumoto, Y. (2008) The Ruby Programming Language, Sebastopol, CA: O'Reilly. p.409.

Hazell, W. (2015) New CQC role may 'taint' quality remit, Health Service Journal, 17 June. 125: 6451, p.5.

Thursday, January 26, 2012

Scope, Space, Nursing, Informatics: Fusion II (care)

After Paolo Perrotta (see post January 20, 2012):

and Paolo Perrotta, (2010). Metaprogramming Ruby, The Pragmatic Bookshelf. p.75.


Imagine being a care coordinator making sense and sense making (Dervin, 2005) your way through a new health and social care referral: here is the care program(me) approach. You jump from care problem, to strength, to further assessment question ... until the care domain priority is resolved. A decision point. That's the initial scope (and in an urgent / crisis situation this is resolved in an instant).

The scope is not defined in a single program, but several in parallel. This is why health and social care is often described as complex. You find yourself in a complex. At this decision point you are at the center of a range of local variables.

You can see bindings all over the scope. p.75.
There are assumptions, hypotheses and bits of data yet to be fully apprehended. It's hard but vital to be aware of what is objective and what is subjective. Why?
Raise your head, and you see that you're standing within an object,
[ a very special object ]
with its own methods and instance variables; that's the current object, also known as self. p.75.
To your immediate left and forward there are instance variables: beliefs, choices, motivation, aspirations, memories ... and the unique ability of this self to use its methods to communicate and interact with other selves, the world and future. You notice a problem. Many of the methods you might expect are not intact. There is a problem with the capacity of memory. Where there should be several parameters in sequence: there is. One. This may even then be lacking. Reading and writing is a problem here.

To the right and forward there is a monthly weight chart, a medication administration chart, BP and pulse are also recorded. There is a history of falls, a fractured femur, and bruising. There is a diagnosis - an inguinal hernia. Two postcodes have you momentarily perplexed. Ah, one is static 'home'; the other is current location and that's a close to home telecare mediated match.
 
Turning first to your right and over your shoulder there is an issue with care management and wandering at night: a vulnerability for this person. Another instance variable then flags mental capacity for a that hernia which needs repair. Respite care vouchers have been issued, but the year's allocation remain unused.

Next, turning around to your left there are details of next of kin and the fact that the carer involved is under a great deal of stress.
Further away, you see the tree of constants so clear that you could mark your current position on a map. p.75.
You are in fact encircled by a series of official identifiers. First at 10 o'clock two first names - these are the names that are given. The names for the person, the individual who is the focus of the referral. At two o'clock a key event for this individual their DOB - date of birth. At four o'clock the digits of the NHS number and a local case record number are captured. Completing the "Full name" at 8 o'clock you find a surname, the family name. It's double-barreled too. An explicit effort to preserve and extend family history and lineage.
Squint your eyes, and you can even see a bunch of global variables off in the distance. p.75.
Global variables.
What lies behind them?

It sounds strange to describe the person as an object, even if the context alludes to informatics.
To confirm this object is special. When you think about it though this object, the patient, the person, the individual, this self has a partner: the healthcare professional.

When we say that positive, high quality care values are global that makes sense. They should be: globally. To say they are variable seems to invite poor quality care, slack standards, inequality, inequity. Acknowledging that standards do vary can help ensure vigilance and that high quality care remains the key aspiration for new learners and experts alike. Nursing and other values are then a global variable that need constant attention and governance.

Friday, January 20, 2012

Scope, Space, Nursing, Informatics: Fusion I

Paolo Perrotta writes:

Imagine being a little debugger making your way through a Ruby program. You jump from statement to statement until you finally hit a breakpoint. Now, catch your breath and look around. See the scenery around you? That's your scope.

You can see bindings all over the scope. Look down at your feet, and you see a bunch of local variables. Raise your head, and you see that you're standing within an object, with its own methods and instance variables; that's the current object, also known as self. Further away, you see the tree of constants so clear that you could mark your current position on a map. Squint your eyes, and you can even see a bunch of global variables off in the distance. p.75.

Paolo Perrotta, (2010). Metaprogramming Ruby, The Pragmatic Bookshelf.

Saturday, April 09, 2011

Nursing ideas somewhere between Drupal & Ruby

It's been a busy week:

  • getting ready for the Scottish Ruby Conference [SRC] three fascinating days 7 - 9 April.
  • checking with the client of the Drupal site, confirming that the following CSS3 adornments are not required: coloured lettering : 3D text : and others. KISS - OK!
SRC started with the charity day a day long tutorial from Chad Fowler author of The Passionate Programmer and Keavy McMinn. They delivered too - indeed it's all great! The venue - The Royal College of Physicians is quite amazing, full of history in its architecture and the portraits of esteemed members. Whether or not I attend a session in there today I must visit the library. The charity day covered:
  • Blocks and bindings
  • The Ruby object model
  • Meta-programming
  • Hooks, callbacks, and reflection.
When it came to the exercises I let the experts do their thing and followed the solutions. I missed last year's Ruby bash so it's good to be back.

Swapping to Ruby while tinkering with Drupal is not a help and yet there is overlap. GIT is the must-do within both communities. PHPNW's meeting on Wednesday on OOP with Lorna Mitchell highlighted some common aspects. I'm probably getting a lot of this (as in 'all' plain) wrong but Lorna's mention of $this and static methods sent me on a reverie. ...

Abstract classes are apparently incomplete and $this is not available to them. Suddenly I'm thinking well that's different. In nursing our abstractions on nursing care are complete - in the idealised sense. It's the concrete / practical (dynamic) delivery that sadly falls short.

PHPNW - the conference in October, a Saturday event in prospect and being here in Edinburgh reminds me I have this itch. Dave Hoover's keynote spoke about his career and finding his technical groove from a therapeutic role as a psychologist.

One thing I do know: from the books he mentioned I ain't got 10,000 hours. That's why I am trying to leverage Drupal and in Ruby - the Rails framework. There's an IDE I have just learned of JetBrain's Ruby Mine.

(Despite that) I'm reading Martin Fowler's book on Domain Specific Languages. Not because I'm going to write one (or like rashes), but because I'm totally intrigued and wondering about a research question. What question(s) can I ask that I might also be able to answer (or not)?

method_missing, meta programming and DSLs are still here in Edinburgh. No longer the latest and greatest (Jim Weirich suggested that was c.2006), but then neither are models of nursing. ;-)

In his book, Fowler identifies 'illustrative programming'. Spreadsheets are the key example and quite remarkable in how they are used and the niche they occupy from a programming, DSL, and an everyday tool perspective.

Hodges' model is a spreadsheet; or a decision table of sorts. Basically, does the patient have a problem in each of the care domains? Fowler writes:
The key benefits of a DSL - greater productivity and communications with domain experts - really kick in when you are using an alternative computational model. Domain experts often think about their problems in a nonimperative way, such as via a decision table. An Adaptive Model allows you allows you capture their way of thinking more directly in a program and the DSL allows you to communicate that representation more clearly to them (and yourself). p.116.
I'm really taking liberties with definitions. My domain experts might actually be student nurses.

I know book titles are intended to sell, but I look at the title of Chad Fowler's book above and wonder about the Compassionate Care Programmer and what alternative computational models may be needed to achieve that?

Fowler, M. (2010) Domain Specific Languages: Addison-Wesley Signature Series, Addison-Wesley Professional.

Tuesday, September 15, 2009

Nursing Variables and Constant Values

From the ancient days of BBC BASIC I am today still trying to pick up some PHP to help me grasp Drupal (and Ruby).

In declaring variables - a key element of computer programs - I thought about the following both as a VARIABLE -

$nursing_care = "variable"

- and as a CONSTANT.

Which made me wonder: when do we want nursing to be a 'variable' and when a 'constant'?

The answer is of course obvious.

Nursing care must be a VARIABLE when it reflects the care plans and objectives that relate to a person - a unique individual.

Alternately, what must be declared as CONSTANT are -

safety, values and good-high quality nursing care.

You may wish to consider what other aspects of nursing and your practice are either variable or constant in nature?

Monday, April 20, 2009

Cash Transactions : Care Continuity

In programming major applications such as finance there is a need to ensure within the transactions and the database operations that mistakes do not occur.

The classic example is a transfer between two accounts:

def transfer(from, to, amount)
  from.debit(amount)
  to.credit(amount)
end
It is vital that the above method (example provided by Tate and Hibbs) does not fail after the debit. In Rails the transaction method help to prevent 'digital accidents' as follows:
def transfer(from, to, amount)
  Account.transaction do
   from.debit(amount)
   to.credit(amount)
  end
end
transaction is itself a method built into Rail's Active Record that helps to maintain the integrity of transactions. Which brings me to 'care'. ...

There are several blog posts here since you reach a stage in your career when the hard fought lessons of yesteryear have to be faced again but this time like after dinner wind.
There are many possible care transactions that arise.

Many have a specific context and frequently these are conjoined:
  • timing
  • relationships - trust
  • responsibility - transfer
  • care environment
  • record (paper, electronic)
As to care transaction consider these:
def transfer(from, to, care_plan)
 Care.transaction do
  from.hospital(care_plan)
  to.community(care_plan)
 end
end

def transfer(from, to, day_care)
 Care.transaction do
  from.home(day_care)
  to.day_center(day_care)
 end
end
Wherever, whenever, whatever and whoever your transactions involve, take care of them and remember in health and social care (esp.) outcomes add up.

Don't forget to look after the however: the information, the knowledge, the promises ....
def transfer(from, to, promise_plan_of_action)
 Care.transaction do
  from.nurse(promise_plan_of_action)
  to.carer(promise_plan_of_action)
 end
end
Reference: Bruce Tate, Curt Hibbs (2006) Ruby on Rails: Up and Running, O'Reilly, p.35.

Saturday, April 18, 2009

Nursing as reverse engineering...

At Scotland on Rails last month one of the sessions included an example of Ruby code outlining a 'morning routine'. It comprised a series of tasks and sub-tasks all of which led to getting to work.

Much of the vital essentials of the code I cannot understand beyond some tentative inklings, but in the hope of learning I've re-hashed the accessible bits and turned it into a NursingRoutine. The output looks like this....

Nursing....
"Non-judgmental attitude"
"Universal positive regard"
"Basic counselling skills"
"Open mind"
"Meet person"
"Receive referral"
"assess person utilizing Hodges model"
"Create care plan"
"Meet physical needs"
"Meet interpersonal needs"
"Meet political care needs"
"Meet social care needs"
"Holistic care"
"Evaluate physical needs"
"Evaluate interpersonal needs"
"Evaluate social care needs"
"Evaluate political care needs"
"Evaluate care"
"caring..."

Something like nursing is obviously a much more complex routine than that implied above - that is because:

  • nursing is not [some - 'thing'];
  • nursing can be represented as a routine BUT;
  • nursing seeks to transcend the routine: emphasizing the personal, unique, the humanistic;
  • nursing is parallel and sequential;
In addition now we are about collaborative, multidisciplinary care that must factor in agreement (the care plan...), and patient reported outcome measures (PROMS). ...

In the meantime I need to exercise care trying to understand the program that produced the output (that could also be easily printed as a list). While this is not an example there is such a thing as obfuscated code, but surely not obfuscated nursing care?

Wednesday, April 01, 2009

Scotland on Rails 2009

1 April mmm... while it is not yet self evident I should by now have an all singing and dancing website. In fact maybe I should have two, since the conference score is currently:

DRUPAL :1 (Drupalcon Szeged 2008) Ruby and Rails :2 (Scotland on Rails 2008 & 2009)

Having just returned from Edinburgh and three days of presentation magic - not only were the speakers experts and leaders they all knew how to present - it's time for me to reflect a little.

Jim WeirichI took something away from ALL the presentations as I attended 'a full stream' mostly the sessions in the main hall. Jim Weirich's session on Building Blocks of Modularity was very interesting informatically, holistically and clinically as he explained and referenced “connascence”:

An examination of the concept of “connascence” and building modular programs.

Connascence: n.
* The common birth of two or more at the same time; production of two or more together.
* That which is born or produced with another.
* The act of growing together.


Connascence: undoubtedly a concept to add to 'consilience'.

Whether using Drupal or Ruby - Rails I'm conscious that you can create a website very quickly. As already ack. here last summer in Hungary Dan and James advised that I get something together and publish the beta. On Saturday Steven A Bristol stressed the same:

  1. Identify the essential thing you have to offer through a website / application;
  2. do not wait until it is 'finished';
  3. - speaking of which are you a techie or designer? Find the partner(s) you need, people are rarely both;
  4. ensure you include a feedback mechanism - not just e-mail;
  5. and 'get it out there'.
In their session Kevin McDonagh and Joseph Wright added that it is a waste of time appealing to the World. Of course Kevin did not realise how painful it was for me to hear that, but since this is certainly true - I have appealed to the world - it was very therapeutic. Unlike Kevin and Joseph's Green Map as a Community Project I'm not sure if whether I can appeal to the local community (despite an interest in ecology).

Dave Thomas of the Pragmatic Programmers by Fraser Spiers at SoR 2009Like Drupal the Ruby community is a terrific group of people - welcoming, supportive, cohesive - a bunch of real humans. The charity tutorial day raised £7,000 for CHAS the Children’s Hospice Association Scotland.

After Dave Thomas presented a fascinating keynote on the Ruby Object Model, Erin Staniland and Tim Harding confirmed I've the basic building blocks in place to create and execute a Rails application on my MacBook.

Peter Jones at SoR March 2009 image by Fraser SpeirsI am hooked on Drupal and Ruby. Some of the keywords and structures in Ruby are dangerous in their appeal - more on this to follow...

Driving (ironically) back to NW England I realised Earth Hour was in progress, hopefully there will be another one. That night Orion was beautiful chasing a fresh smiling new moon along the way...

Images: thanks to SoR site and Fraser Spiers

P.S. Kevin - I owe you a beer towards the taxi Friday night!

Wednesday, October 01, 2008

Reflection: programming and caring II

Reflection: (Ruby Pocket Reference, O'Reilly, 2007, p. 147.)

The ability of a language such as Ruby
to examine and manipulate itself.
For example, the reflection method class from Object
returns an object's class ("hello".class # => String).

Reflection within health and social care - is there a further definition ...?

Well yes, there are several, but there may be another ...?

The ability of a health and social care model such as Hodges' model
to examine and manipulate itself *
in response to an individual's (and family's)
care situation and context.
For example, the reflection method class from Object
returns an object's class (Intrapersonal.class # => Domain)#.


*This would require of course that Hodges' model is represented as a programming language or formalised conceptual space of some sort....
#Or something like this....

Saturday, September 27, 2008

Composability: programming and caring

Composability: (Ruby Pocket Reference, O'Reilly, 2007)

The degree to which you can express logic
by combining and recombining
parts of a language
(p. 136).

Composability within health and social care - is there a further definition...?

The degree to which you can express care situations
by combining and recombining
the parts of a language encompassed within a health and social care model,
(a dedicated conceptual space).

Monday, April 07, 2008

NetBeans, Eclipse and IntelliJ

I've made some progress getting to know Eclipse as a programming environment, but on Friday night (as per the post) I was told about JRuby (which I'd confused with IronRuby) and advised to take a look at NetBeans. So now it's installed, registered and yet another 'hello world' program has run.

Although I know little of Java I recognise an industry heavy weight when I see one. Walking past the coffee house at Oxford Road Manchester I often wondered wish I had time to get to know Java proper. Java's is too much for me and like the armchair astronomer I currently am, in theory so far Ruby has caught my eye and imagination. Behind Java though there is a huge catalogue of libraries and at present Ruby is written in Java.

Apparently the IDE of choice is IntelliJ, but this is not Open Source. I will download this too c/o a trial demo. Wonder if they sponsor worthy causes...? Following Scotland On Rails and Joe O'Brien's observation to focus on Ruby not just Rails, I must also use irb - that is interactive Ruby. It's copied on to the Eee PC now.

I'm working my way through the jQuery in Action book. One existing website page that will benefit from a review and recode is the FAQ. Already I'm thinking about what animations /effects it is sensible to use. It will be interesting to revisit the page created in response to Pippa's question on the humanistic-mechanistic axis. The jQuery used was lifted from a tutorial/blog site and although edited it probably contains some errors / redundant code.

I have not mentioned Drupal for a while, we'll get there.... There's another book on the shelf Learning PHP & MySQL. Must chase the new Drupal 6 book from Mercer too.

Friday night chatting another Ruby-Rails delegate in Edinburgh mentioned having been put-off by the prospect of tackling databases and then I realised: Yes, that's me too - the rabbit like eyes : the glare of headlights - it's all there.
Must seek some therapy, or get off the road....

Saturday, April 05, 2008

"Great Scot!" Ruby & Rails - Scotland On Rails

Just back from Edinburgh this evening. Took it steady about 60mph, so used just half a tank of fuel - not bad for 400 miles (return). Had to take it easy as it was just above freezing in places and I ended up playing Star Trek. It was snowing for a time North of Penrith. When I was able I put the head lights on full-beam: warp drive!

Scotland On Rails was great - the organisation, speakers, content and company. The sessions I attended included testing, testing testing, migrating to Ruby 1.9, DSLs .... and the last session on JRuby with the announcement of version 1.1 that provoked a round of applause:

JRuby on Rails: Up And Running!

Charles Oliver Nutter and Thomas Enebo

JRuby 1.1 has been released, and is becoming the Rails platform of choice for many Rails shops. In this session, we’ll show how to start from scratch or migrate your existing Rails app to JRuby. We’ll demonstrate the various deployment options on JRuby. We’ll show how to integrate Java libraries into your app. We’ll walk through NetBeans’ Ruby and Rails support and talk about how JRuby has enabled better tools and better solutions for Ruby developers. And we’ll have a conversation with the audience about where JRuby on Rails should go from here. Be prepared to talk shop and see lots of code and demos.
I'd been really looking forward to Joe's presentation on DSLs and was not disappointed. My enthusiasm here is not because Hodges' domains makes a DSL a dead-cert, far from it; it's just that I miss playing with Plasticine:
Domain Specific Languages : Moulding Ruby

Joe O'Brien

Ever wondered what all the fuss is about when it comes to DSL’s and Ruby? It seems to be all we hear about. This talk will peel away the onion and look at what it is about Ruby that makes it the perfect candidate for creating your own languages. I will show you, through examples, how you can create your own languages without the need for compilers and parsers. We will also cover some real world examples in areas of Banking and Medicine where DSL’s have been applied.
Amid the clamour that is Rails, Joe also stressed that people should focus and explore Ruby itself. Something I need to get on with. Paul Dix's talk this afternoon was fascinating in terms of scale, processing, math libraries and mention of clustering:
Collective Intelligence: Leveraging User Data to Create Intelligent Rails Applications
Paul Dix

Take advantage of user data to create intelligent Rails applications! This talk will focus on data mining to create complex application behavior and gain insight into the patterns and habits of your users. Examples of these techniques can be seen with recommendation systems like those created by Amazon, Netflix, last.fm, and others. Additional examples include spam filtering systems for email or comment filtering provided by Akismet.
I will focus on techniques for gathering data, specific gems and plugins for performing various data mining and machine learning tasks, and performance issues like how to distribute the work to separate servers. Theory in this talk will be light and the specific algorithms will only get a mention by name. We’ll be looking at real world Ruby and Rails code examples for building recommendation, ranking, and classification systems.
I wasn't the only Ruby newbie and met a few of my peers, we noticed on the first day the number of sessions on the theme of testing. Last week I'd watched Matz' February talk on Ruby 1.9 and the future which helped me out through the past two days. Last night in The Crags one of the speakers Ritchie (whose session I missed) kindly explained about his conjoint talk and the significance of JRuby, NetBeans IDE and IntelliJ. Given Richie's knowledge, experience and that closing session, I'll definitely investigate these.

There's only one conclusion - totally overwhelming: but totally worth the brain ache.
So great job and many thanks to Alan and the team, plus the luminous speakers and sponsors.

Saturday, March 29, 2008

Week ahead: Ruby/Rails conference and next paper?

It should be a stimulating week ahead as the clocks spring forward (why not two weeks ago?) and I check the schedule for Scotland on Rails and plan the sessions to attend. Now with a new Eee PC I should also have something to write on and connectivity.

Yesterday jQuery in Action arrived. I've started to read it and am finding already that the two CSS books that were until recently just sitting on the shelf are helping me to grasp what jQuery is about. One of those titles - Keith or Cederholm - highlighted that learning CSS helps you to understand and learn other languages and this really does seem to be the case. jQuery in Action will definitely be travelling to Edinburgh. Even though I'm only at chapter 2 it's a good read. There's a Selector Lab a web page to enter jQuery selector strings and see how the code relates to the DOM (document object model).

Over the past week I've been investigating Ruby graphical user interface (GUI) toolkits - specifically Tk (must check version 8.5). Just as with Drupal and settling on a theme, eventually - it seems? - I will have to choose a GUI. For now it's a case of seeing what they offer and how to run them within Eclipse (and without). The jQuery book will help push me with Drupal and enliven what will be essentially be static (archive) content:

  • Archive - Brian's original notes; my introduction
  • Biographies - Brian, myself - and who knows other contributors
  • Chronology
    • - still thinking about other content
      • old - e.g. the informatics pages
      • and new - a h2cm collaborative book.
There is no word as yet about the socio-technical chapter submitted in the new year, which may be good news? Although there's enough going on above, I like to have a paper on slow cook. So, we will see what arises on mapping, concept organisation ... in health care, communication and education. As a starter (c/o free access to SAGE journals) there are several papers on intervention mapping within public health and health promotion that will be essential reading. Another ingredient to (potentially) add to the mix - I've long wondered about case formulation within psychological therapies and Hodges' model. Time to make a start, but real slow like...

Sunday, March 23, 2008

Drupal, Eclipse and Ruby - GUIs?

It was a long day yesterday. The wind (outside) woke me at 0500 so that was that. After collecting the recycling bins and the contents I set to work.

Last Thursday I attended the NW England Drupal meeting again, a great way to find inspiration and lessons on how to 'best proceed'. There is a training event organised for next month by Chris and James of menus & blocks, but being mid-week I can't make it (even with funds). After the meeting I started the server again and loaded the Drupal sites versions 5.2 and 6.0. The last time with 6.0 there was a problem with modules and memory limits. This is now resolved and tomorrow I'll explore some more. jQuery in Action should arrive this week. I should follow-up on the kind offer of free hosting by Chris Ward from last December.

Although missing the Drupal training event, I have managed to book for two days for Scotland On Rails. I'm really looking forward to this as already mentioned here.

Over the weekend Eclipse and Ruby have been a pre-occupation, especially GUI support for windows, buttons and graphical widgets. Before things go awry I watched a screencast on debugging in Eclipse and proving that this (basically!) works on my set-up and with require 'tk' in place I've run through several Tk tutorials and started to explore just what the GUI toolkits have to offer.

The experimentation in the Ruby GUI space continues. There are many old style bindings to GUI toolkits such as Qt or GTK, or embedded DSLs or APIs based on JRuby such as these three new ways of building GUIs with Swing. These libraries use different approaches for building and arranging GUI components.

Ruby Shoes is a GUI toolkit with a slightly different focus. Ruby Shoes is a creation of Why The Lucky Stiff, author of Why's (Poignant) Guide to Ruby and prolific programmer of libraries such as HPricot (HTML Parser), the web framework Camping and many others. Why's toolkit Ruby Shoes, is a GUI toolkit built on GTK technologies Cairo (drawing) and Pango (for text). The number of GUI controls it supports is limited by design, and the ones that do exist use OS GUI specific components. Currently MacOS X, Windows and GTK versions are available.


The entry goes on to describe the influences behind Shoes that includes Processing - 'an open source programming language and environment for people who want to program images, animation, and interactions.'

Sunday, March 16, 2008

BASIC, Ruby, DATA and Scotland On Rails

This weekend reading more of Hal Fulton's The Ruby Way, there was a blast from the past in the form of '10.1.25 Reading Data Embedded in a Program' and a reminder of all those DATA statements typed in from magazines.

Ruby not only supports the industry database and SQL standards, but other approaches such as embedded data and KirbyBase. Fulton's book is designed for 'random access' and yet I'm reading it through. There are jewels in the texts on Ruby. Sentences that while fairly obvious still serve to catch my breathe '... They differ in the amount of context they copy. ...'

10.4.7 Object-Relational Mappers discusses ActiveRecord and Og (object graph). Apparently Og can generate a database schema from Ruby class definitions (rather than vice-versa). This is a useful and powerful ORM 'especially if you design your database after your objects.' p. 384.OK ....

With all this reading on databases whatever happened to the Associative Data Model? Still alive and very well I believe, yet more Sentences to figure out.

In order to try and make some headway, next month I'm heading for Edinburgh and the Scotland On Rails conference.

I can't attend the full event, but plan to make sure the trip is well worthwhile. While I hope all the speakers stay in fine fettle, there is a speaker for Saturday whom I pray stays in finest lustre - a presentation on DSLs! Just one highlight of what should be a great talk. [Stay well Joe!]

Tuesday, March 11, 2008

Ruby Holistic I

Using BBC BASIC many years ago as I recall I used an array to capture user input and then save this data to files.

I've just written a very simplistic Ruby program, not very Rubyesque in its code style to capture some data and store this in an array. There are many options here and not limited to:

  • declaring an array from the outset;
  • using a hash;
  • using MySQL.
At present it's just about getting used to the Ruby syntax. I have yet to write a class and methods of my own and resort to file handling. Looking forward to doing so. Not far into the Ruby on Rails book it was getting very interesting so I need to pick that up again too...!

Also need to get back to Drupal and the new versions of Brian's notes and my introduction to the model and website. How many themes and modules are Drupal 6 compatible now? It's the NW England Drupal user group meeting again on the 20th in Manchester.

Monday, March 03, 2008

DSL examples - thrills and spills: "Data lend me your ear!"

The final chapters of Olsen's book Design Patterns in Ruby made my lips dry. I hadn't checked ahead, but Olsen mentions mid-text what's to follow. In getting there and reading about the Interpreter pattern and DSLs, I do hope this does not prove a one-off date. Olsen's book IS brilliant (and besides Ruby looks so dynamic across the dance floor), but the examples used were tinged with anti-climax and prompted a reality check.

Olsen's examples DO illustrate the principles, like most things worthwhile they need deliberate reading, but they DO deliver. So what's up? Well, the examples presented are taken from the world of IT (file backup). Yes, I know... well what do you expect! I had hoped for a DSL from a less technical domain; something left-of-centre, something that traverses the HUMANISTIC - MECHANISTIC divide. This is where the definitions of domain, DSL and the craft of caring and programming can (possibly) provide some useful insights.

For decades the literature and projects have focussed upon nursing languages. Communication relies on language of course. Even the absence of messages - verbal, non-verbal or other - tells us something. In health and other professions great emphasis is placed upon communication skills. We have to listen actively. How we listen - the constraints, what we deem as significant, and what is subsequently recorded and retained defines our care domains.

Star Trek Galactic QuadrantsThe domains that are the subject of DSL are specific, which explains how they can be implemented in some 50-70 lines of code (this also says something about Ruby). In contrast, within Hodges' model those four domains may as well be galactic quadrants they are so broad. Regardless of this (non-trivial) issue, standing at the nexus of h2cm the question needs to be asked (and is constantly being asked by health & informatics communities):

How good a listener can the MECHANISTIC ear be?

Saturday, February 23, 2008

Domain Specific Languages [II] + a Ruby mixin

Last year in one of those pick-it-up:put-it-down cycles, I surfed into this article on DSLs and Ruby c/o:

Artima logo

Ruby Code & Style Creating DSLs with Ruby
by Jim Freeze, March 16, 2006

Although as mentioned the other week, I'd read - and keep reading! - Chris Pine's intro Ruby book and the Thomas's Pickaxe, much of the code is hard to follow for a beginner - here's a snippet (from page 3 of 4):

[n.b. Some lines below are incomplete due to Blogger's interpretation of the characters]
Again, we update the require statement in dsl-loader.rb to load the mydsl4.rb file and run the loader:
% ruby dsl-loader.rb params.dsl
#
["@parameter", "@name"]
This is all well and good, but what if we don’t know the parameter names in advance? Depending on the use cases for the DSL, parameter names may be generated by the user. Never fear. With Ruby, we have the power of method_missing. A two-line method added to MyDSL will define a DSL attribute with dsl_accessor on demand. That is, if a value is to be assigned to a (thus far) non-existent parameter, method_missing will define the getters and setters and assign the value to the parameter.

% cat mydsl5.rb
require 'dslhelper'

class MyDSL
def method_missing(sym, *args)
self.class.dsl_accessor sym
send(sym, *args)
end

def self.load(filename)
# ... Same as before
end
end

% head -1 dsl-loader.rb
require 'mydsl5'

% ruby dsl-loader.rb params.dsl
#
["@parameter", "@name"]
Once again Olsen's - Design Patterns in Ruby has helped me (to begin to) understand  method-missing (p.184). I swear I heard some clanks as the pieces re-arranged themselves and one or two fell (almost) in place. Having copied Freeze's code into Ruby, it would not run. At least now the code is not as complex looking at it was and reading it through now it makes a lot more sense. I'm really looking forward to trying this again in Eclipse. On that first exposure I had a vague notion of the principle of method-missing, but reading Olsen's book I've a better grasp and may be able to keep hold of this and other Ruby concepts. Believe me that helps in my pick-it-up:put-it-down world.

more to follow ....