Archive for April 2011

Idea for a concise syntax of nested models in cucumber

April 22nd, 2011 by Scott Cytacki

I started thinking about how to more easily specify some of the deeply nested structures we need during testing.

First we already have a step for doing this.  An example which looks like this:

And the following investigations with multiple choices exist:
| investigation         | activity    | section     | page       | multiple_choices  | image_questions   |
| first investigation   | act 1     | section 1  | page 1   | a, b              |                   |
| first investigation   | act 2     | section 2  | page 2   | c, d              |                   |
| second investigation  | act 3     | section 3  | page 3   | b_a, b_b          | image_q           |
| second investigation  | act 4     | section 4  | page 4   | b_c, b_d          |                   |

That is using some previously defined multiple_choice and image_question objects. I was trying to see if I could write it more like this:

And the following investigations with multiple choices exist:
      investigation "first investigation"
        activity "act 1"
          section "section 1"
            page "page 1"
              multiple_choice :prompt => "Prompt 1", :choices => "a,b,c,d", :correct_answer => "a"
              multiple_choice :prompt => "Prompt 2", :choices => "a,b,c,d", :correct_answer => "a"
            page "page 2"
              image_question :prompt => "Image Prompt"

I didn’t see an easy way to do that but with a little method_missing, haml, and using cucumber’s “”” notation, the following looks pretty straight forward:

And the following investigations with multiple choices exist:
      """
      - investigation "first investigation" do
        - activity "act 1" do
          - section "section 1" do
            - page "page 1" do
              - multiple_choice :prompt => "Prompt 1", :choices => "a,b,c,d", :correct_answer => "a" do
              - multiple_choice :prompt => "Prompt 2", :choices => "a,b,c,d", :correct_answer => "a" do
            - page "page 2" do
              - image_question :prompt => "Image Prompt" do
      """

In a simple implementation a map could be used to define the code to add a child object. So for investigation it would be {activities<<child}, and for page it is {add_element(child)}. The creation of of the objects could use factory girl so the names could be any of the existing factories.

I’m curious if anyone has seen something like this that is already written? And I’m wondering if there is something like haml that uses indentation for blocks but defaults to “ruby mode” so there wouldn’t be a need for the “- ” before each line.

Poison helping to develop life?

April 8th, 2011 by Sarah Pryputniewicz

Formaldehyde has many industrial uses–in particle board, plywood, carpet, and adhesives, to name just a few.  Formaldehyde is toxic to life–the reason that it’s used as a disinfectant–and the reason that many countries have banned the use of formaldehyde in furniture and housing materials.

But formaldehyde may well have formed the basis for life in our solar system.

New research, published in the Proceedings of the National Academy of Sciences on April 4, 2011, shows that complex organic solids were likely made from formaldehyde in the primitive solar system.

George Cody, Conel Alexander, and Larry Nittler did experiments to try to make the type of organic matter found in meteorites.  When they started their reactions with formaldehyde, they found that the organic material that was created was similar to the organic material in the meteorites and also similar to the organic material found in a comet that NASA had sampled.

“We may owe our existence on this planet to interstellar formaldehyde,” Cody said. “And what’s ironic about it is that formaldehyde is poisonous to life on Earth.”

Formaldehyde is relatively abundant throughout the galaxy, making it possible that life could form in other solar systems in the same way that it formed in this solar system.

http://www.sciencedaily.com/releases/2011/04/110404151351.htm

Online Learning as a Supplement, not a Substitute

April 7th, 2011 by Andy Zucker

In the past two days the New York Times has provided readers with six fascinating articles and discussions about online learning. One set is called Room for Debate: Can Young Students Learn from Online Classes and the other is a front-page article in yesterday’s paper: More Pupils are Learning Online, Fueling Debate on Quality.

The quality of these articles and many reader comments is excellent, and the best of them are nuanced. Only a small fraction of students have ever taken fully online classes, so it is very difficult to generalize from these volunteers to conclusions about all or typical students. Some pieces, like Karen Swan’s entry in Room for Debate, cite studies investigating which students are likely to succeed online, and which are not.

Online learning offers genuine benefits to some students (such as access to courses not available in a local school) and will continue to spread. Very likely the scenario that will help the most students in grades K-12 is that more and more teachers in brick-and-mortar schools add online features to the courses they teach face-to-face. Students can then continue a lively discussion after school hours, interact with experts who never visit the school, or use computers and the Internet in other ways that supplement, rather than substitute for, what happens in school. In contrast, the vision of most American students taking a large percentage of their courses online, without a face-to-face component, may appeal to politicians as a way to reduce costs but seems very ill-suited to adolescents’ needs. Let’s not go there!

Andy Zucker
Senior Research Scientist
The Concord Consortium
Lead author of The Virtual High School: Teaching Generation V (Teachers College Press, 2003)

Thinking like a scientist

April 6th, 2011 by Sarah Pryputniewicz

Nearly every day, newspapers report on new scientific breakthroughs.  Scientists provide measures of their uncertainty in the results, expressed as a p-value.

The p-value is a statistical measure of the randomness of the results; a lower p-value indicates that the reported result is not likely due to chance.  In scientific studies, a p-value of 0.05 (or 5% likelihood of the result being due to random chance) is considered significant. Put another way, if the same test were done 100 times, a result would have to happen 95 times out of 100 to be considered significant.

"'So we did the study again, and got no link. It was probably a--' RESEARCH CONFLICTED ON GREEN JELLY BEAN/ACNE LINK; MORE STUDY RECOMMENDED!"

http://www.xkcd.com/882

Scientists test their hypotheses multiple times to be sure of the significance of their results.  Even though one test may reach a significant p-value, there’s still that 5% chance that it could be due to chance.

Unfortunately, that doesn’t make for good newspaper headlines.  So, when you read news about science, think like a scientist and look at the data and results with a scientifically-critical eye.