Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 1/5/2012 – The Death of SOAP

Glenn Jahnke
Thursday, January 5, 2012

Helps

Soap4R and Ruby 1.9.2

“Soap4R and Ruby 1.9.2 don’t work, what’s the best alternative?”

Several people recommended the Savon gem. It was strongly suggested to not try and replicate any of the Soap protocol because it is pretty painful to implement.

Interestings

Constants versus Immutable Objects

Someone apparently had confusion around what it means to be constant in Ruby, and what it means to be immutable.

A constant prevents modifications to references to variables.

SOME_CONST = 3
SOME_CONST = 4
warning: already initialized constant SOME_CONST

Immutability means that the variables themselves cannot be modified.

an_array = [1,2,3]
an_array.freeze
an_array[3] = 4
RuntimeError: can't modify frozen array

You should note, though, that freezing an object only makes the variables that object contains immutable. For instance,

an_array = [1,2,3,{}]
an_array.freeze
an_array[3]["foo"] = "bar"

will not throw any errors or warnings.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

One comment

  1. François Beausoleil says:

    I usually freeze each of my objects when I’m making constants:

    ACCEPTED_METHODS = %w( GET POST PUT DELETE ).map(&:freeze).freeze

    This freezes each of the words, and the whole collection as well. The last example could be similarly frozen:

    an_array = [1,2,3,{}].map(&:freeze).freeze
    an_array[3]["foo"] = “bar”
    RuntimeError: can’t modify frozen hash

    But of course, if the values or keys aren’t frozen, the same issue applies.

    January 5, 2012 at 3:09 pm

Add New Comment Cancel reply

Your email address will not be published.

Glenn Jahnke

Glenn Jahnke
San Francisco

Recent Posts

  • 7/13/2012 – Happy Friday
  • iOS Acceptance and Ruby Keywords
  • Standup 1/9/2012
Subscribe to Glenn's Feed

Author Topics

rails (3)
ios (1)
ruby (8)
testing (1)
javascript (4)
jenkins (2)
tdd (2)
scala (2)
rubymine (2)
mysql (1)
agile (5)
iteration planning meetings (1)
performance (1)
jasmin (2)
rspec (1)
data processing (1)
cruisecontrol (1)
rvm (1)
android (1)
mobile (1)
mongodb (1)
concurrent programming (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >