Designing for scalability | Merbist
Terrific post on the elements that go into a scalable design.
Every single class, method, function you write is an API that you and others will use. Remember that every time you write code, you are the implementer of a design, and therefore you are a designer.
On Camping vs Sinatra — Timeless
Not only does Mr. Holm make a convincing case for taking another look at Camping, but the article itself is a rather clever bit of Ruby code. Very well played indeed.
Please don’t mistake me, this is not SIX (UNIMPRESSIVE) REASONS CAMPING IS BETTER THAN SINATRA or even SIX (UNIMPRESSIVE) REASONS YOU SHOULD DROP EVERYTHING YOU HAVE IN YOUR HAND RIGHT NOW AND START USING CAMPING. All I’m saying is that Camping gets so many things right. Not necessarily in very few lines of code or very fast, but nonetheless: I look at Camping code and nod to myself: “Yeah, this is probably the correct way to do it”.
Data Modeling in Performant Systems
I’m probably missing something but by my count this is the second time John has reinvented DataMapper.
What all does Toy::Store come with out of the box? So glad you asked.
- Attributes – attribute :name, String (or some other type) Can be virtual which works just like attr_accessor but all the power of dirty tracking, serialization, etc. Also, can be abbreviated which means :first_name could be the method you use, but in the data store the attribute is :fn. Save those bytes! Allows for default values and defaults can be procs.
- Typecasting – Same type system as MongoMapper. One day they will share the exact same type system in its own gem, for now duplicated.
- Callbacks – all the usual suspects.
- Dirty Tracking – save, create, update, destroy
- Mass assignment security – attr_accessible and attr_protected
- Proper cloning
- Lists – arrays of ids. If user has many games, user would have list :games which stores in game_ids key on user and works just like an association.
- Embedded Lists – array of hashes. More consistent than MongoMapper, which will soon reap the benefits of the work on Toy Store embedded lists.
- References – think belongs_to by a different (better?) name. Post model could reference :creator, User to add creator_id key and relate creator to post.
- Identity Map – On by default. Should be thread-safe.
- Read/write through caching – If you specific a cache adapter (say memcached), ToyStore will write to memcached first and read from memcached first, populating the cache if it was not present.
- Indexing – Need to do lookups by email? index :email and whenever a user is saved the user data is written to one key and the email is written as another key with a value of the user id.
- Serialization (XML and JSON)
- Primary key factories
<li> <p class="diigo-link"><a href="http://netbeans.org/community/news/show/1507.html">NetBeans Community News</a></p> <p class="diigo-description">Boy, Oracle's just batting 1000 these days.</p> <p class="diigo-tags"><span>tags:</span> <a href="http://www.diigo.com/user/avdigrimm/ruby">ruby</a> <a href="http://www.diigo.com/user/avdigrimm/oracle">oracle</a> <a href="http://www.diigo.com/user/avdigrimm/java">java</a> <a href="http://www.diigo.com/user/avdigrimm/netbeans">netbeans</a> <a href="http://www.diigo.com/user/avdigrimm/development">development</a></p> <ul class="diigo-annotations"> <li> <div class="diigoContent"> <div class="diigoContentInner">After thorough consideration, we have taken the difficult step to discontinue support for Ruby on Rails in the NetBeans IDE.</div> </div> </li> </ul> </li> <li> <p class="diigo-link"><a href="https://github.com/michaeldv/awesome_print">michaeldv/awesome_print - GitHub</a></p> <p class="diigo-description">Ruby object pretty-printer.</p> <p class="diigo-tags"><span>tags:</span> <a href="http://www.diigo.com/user/avdigrimm/ruby">ruby</a> <a href="http://www.diigo.com/user/avdigrimm/console">console</a> <a href="http://www.diigo.com/user/avdigrimm/irb">irb</a> <a href="http://www.diigo.com/user/avdigrimm/development">development</a></p> </li> <li> <p class="diigo-link"><a href="http://www.drdobbs.com/architecture-and-design/229000996;jsessionid=44PPL3XDNDZMJQE1GHPSKHWATMY32JVN?pgno=2">Dr Dobbs - Certified ScrumMaster Examined</a></p> <p class="diigo-description">Scott Ambler tears into Scrum Master certifications.</p> <p class="diigo-tags"><span>tags:</span> <a href="http://www.diigo.com/user/avdigrimm/agile">agile</a> <a href="http://www.diigo.com/user/avdigrimm/development">development</a> <a href="http://www.diigo.com/user/avdigrimm/scrum">scrum</a></p> <ul class="diigo-annotations"> <li> <div class="diigoContent"> <div class="diigoContentInner">I’ve said it before and I’ll say it again — The Scrum community, and to a lesser extent the agile community in general, has embarrassed itself by tolerating the CSM scheme. Enough is enough. We can do better, and until we do so, our integrity debt continues to grow.</div> </div> </li> </ul> </li><p class="diigo-ps">Posted from <a href="http://www.diigo.com">Diigo</a>. The rest of my favorite links are <a href="http://www.diigo.com/user/avdigrimm">here</a>.