Nitro + Og 0.17.0, Og Reloaded, Elements

G

George Moschovitis

Hello everyone,

new versions of Nitro and Og were just released.

Homepage + Downloads: http://nitro.rubyforge.org

The biggest release yet, featuring the brand new implementation of Og.
Due to the many changes this should be considered a preview release, a
stabilized version is expected shortly. Bug reports and comments on the
new features are especially appreciated. Many thanks to Michael
Neumann, Dan Yoder and other hackers on the mailing list for ideas and
suggestions that made this version possible.

Most notable Og additions:

* Extremely clean source code. Better names are used thorougout. Extra
care was taken to make all features more orthogonal.

* Brand new relation mechanism. The 'enchanting' of entities (managed
classes) happens in multiple passes to be more flexible. Totaly
separated graph/metadata creation and serialization code generation.
The Graph metadata can be used for advanced scaffolding, testing and
more.

* Support for fully customizable primary keys. You are no longer forced
to use xxx_oid primary keys. Appart from the extra flexibility this
feature provides, this is an essential step towards the planed 'reverse
engineering' mode that will allow the use of existing schemas with Og.

* More elegant inspection mechanism. Example:

Article.relation:)user) # => Og::BelongsTo(...)
Article.relations # => [...]
Article.properties # => [...]

* Joins_many relation, as an alias for one way, join table relations.

* Support for 'active' collections. Active collection are synchronized
with the backend Store and provide a more elegant interface and the
opportunity for 'session' caching:

article.comments << Comment.new

instead of

article.add_comment(Comment.new) # this is also allowed though.

p article.comments
p article.comments.size # the results of the first query is cached

* Eager relations.

comments = Article.comments:)include => User)

for comment in comments
p comment.user.name
end

Elegantly solves the N+1 query problem by using one join query.

* No need for forward references when defining relations. Now, the
following code magically works:

class User
has_many Comment # works even though Comment is not defined!
end

class Comment
belongs_to User
end

* Use inflection where possible to infer missing configuration options.
For example

class Article
belongs_to User # infects relation name :user
...

* New, lean and mean Store interface. The code needed to teach Og how
to serialize objects to backend store is dramatically reduced. The new
interface is SQL agnostic, so non SQL-RDBM's stores are possible.

* SQL agnostic querying interface, compatible with non-sql Stores. Here
is an example:

Article.find(
:condition => 'hits > 2 AND rate > 3',
:eek:rder => 'title',
:eek:ffset => 30,
:limit => 10
)

* More elegant (and non-sql store compatible) way for selective
updates:

article.title = 'Changed'
article.hits += 1
article.update:)title, :hits)

* New, in-memory store that support all features. This is a pure ruby
solution useful for experimentation. It will also serve as the base for
the forthcoming madeleine Store implementation.

* Allow for multiple stores in one application. A great example,
mysql_to_psql is provided. This example uses Og's powerfull features to
automatically convert a Mysql database to a PostgreSQL database.
Database migration was never easier.

* Uses the excellent Facets utility collection to further cleanup and
minimize the code.

* Managed classes or Entities should include the EntityMixin or extend
the Entity class. Example:

class Article < Entity
..
end

class Article
include EntityMixin
end

This is done to avoid the Module module like in earlier versions of Og.
However, Og is can infer the need to include the Managed mixin in
typical cases:

class Article
property :title, String
# when a property is defined Og automatically converts the
# class to an Entity
end

class Article < AnExistingManagedEntity
# also includes the mixin
...

class Article
include AModuleThatDefinesProperties
...

* Improved support for og_delete interception.

* Support for nested transactions.

Check out the file test/og/tc_store.rb for a demonstration of the new
features.

And some Nitro additions:

* Integrated the Facets library, and started donating some Glue code to
this project.

* Integrated the Prototype object oriented javascript library.

* Included a preview implementation of the new tag library system,
called Elements. This is based on an original idea by Dan Yoder. This
feature is expected to change substantially in the next version. In the
meantime here is an example:

<Page>
Here is a <b>nice</b> page.
<br />
<Box>
This is #{variable}.
<?r if admin ?>
hello admin
<?r end ?>
</Box>
</Page>

The tags <Page> and <Box> automatically instantiate objects of class
Page and Box that handle the rendering. This is an alternative to the
XSLT templating system and can also be used to implement some reusable
components. The hierarchical structure of the elements is available to
each object to facilitate advanced rendering tricks. Just like the XSLT
shader the Elements
transformation is preapplied to the page to avoid the overhead at
runtime.

* Fixed many reported bugs.

I hope this software will be useful to you, and I would love to
receive your suggestions, ideas and bug reports.

have fun,
George Moschovitis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top