Skip to content

Instantly share code, notes, and snippets.

@kadamwhite
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadamwhite/ed71045b71fbbf2b2486 to your computer and use it in GitHub Desktop.
Save kadamwhite/ed71045b71fbbf2b2486 to your computer and use it in GitHub Desktop.
The State of Marionette.js Views
at BackboneConf you mentioned that Marionette was likely going to drop down to just 2 layout primitives, iirc
jmeas 19 minutes ago
ya. hopefully!
kadamwhite 19 minutes ago
Is the idea there that you’ll deprecate two of the existing ones, or will there be a migration to a new thing?
(trying to decide whether to recommend Marionette on a project with a highly-nested UI)
jmeas 18 minutes ago
@kadamwhite, the upgrade path will be super easy. which is why it’s so awesome
no loss of functionality, just fewer concepts for new devs to learn.
trezy 18 minutes ago
@kadamwhite & @jmeas I’ve already converted to that model. I only use LayoutViews and CompositeViews now.
kadamwhite 17 minutes ago
and it’s viable today, @trezy ?
jmeas 17 minutes ago
to answer your question more directly…it will be a migration to a new thing. but those new things will be very similar the old things
kadamwhite 17 minutes ago
(new to Marionette, sry!)
trezy 17 minutes ago
Yup.
jmeas 16 minutes ago
in the next release, LayoutView will simply be ‘gone,’ in a sense. It will just be merged in with ItemView.
the upgrade path is just find and replacing all "LayoutView" and “ItemView" instances and replacing it with “View"
trezy 16 minutes ago
@kadamwhite LayoutViews are just ItemViews with regions added and CompositeViews are just CollectionViews with the option to add some wrapper context.
jmeas 16 minutes ago
in the long-term, CompositeView is actually the one that will get removed
if my plans become realized
CollectionView will remain
kadamwhite 15 minutes ago
that makes you sound like an evil genius @jmeas, heh
trezy 15 minutes ago
@jmeas Really? So CompositeView/CollectionView/XView derived from them will just extend the base View?
jmeas 15 minutes ago
@trezy, they already extend from the base view. Which is currently Marionette.View; renamed to Marionette.AbstractView in the next release
but the two views will be:
LayoutView - manually managed nested views
CollectionView - automatically managed nested views
CompositeView can be created with a LayoutView and a region that replaces its contents with the CollectionView’s el.
trezy 14 minutes ago
Ah, that makes sense. I knew they were extended from View but if View was going to contain all of the ItemView -> LayoutView logic then I was confused what CollectionView would derive from.
kadamwhite 13 minutes ago
View -> AbstractView to make it more obv it’s a primitive and not for use, then?
jmeas 13 minutes ago
@kadamwhite, tl;dr, you can use all of Marionette’s features without worry. even the stuff we’re removing from the library, we’re putting in separate libraries
yup @kadamwhite.
@trezy, it’s a little bit weird because of all of the renaming. They both extend from View right now, which is a base class. But View is being renamed to AbstractView, and they will both continue to extend from it.
trezy 12 minutes ago
Right, I can dig it now.
jmeas 12 minutes ago
even though this might sound like a huge change…it is suuuuper easy to upgrade.
we could even add a CompositeView shim with the exact same public API
but is actually powered by a LayoutView + CollectionView under the hood.
trezy 11 minutes ago
Though having a View and a CollectionView is semantically confusing. I would then expect that CollectionView derives from View.
jmeas 11 minutes ago
tl;dr @kadamwhite; i think marionette is a reliable choice.
trezy 11 minutes ago
Though that could just be me.
jmeas 11 minutes ago
these changes are a ways off, and aren’t too drastic.
trezy 10 minutes ago
@kadamwhite I use Marionette in all of my projects now. It’s a fantastic choice.
@kadamwhite Especially with how well the core team sticks to semver and how seamless they make the upgrade process.
bazineta 28 minutes ago
So…if the compositeview goes away, how would one handle a table, i.e,
childViewContainer: 'tbody’, without the usual and customary extra div shoved in?
jmeas 27 minutes ago
in this world, regions can be placeholders
so you show a collection view and the region’s element gets swapped out
for the duration that the collection view exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment