Organizing Codeby Logical Concernin Vue 3
Talk notes at talks.alexvipond.dev
The promise of Vue 3

Options API

Composition API, organized by options

Composition API, organized by logical concern

Alex Vipond
Kumu
Front end dev
Baleada
https://baleada.devWhat does it mean to organize by logical concern?
What are options?
Options are categories that describe what your code is.
The data
category holds reactive references
The computed
category holds memoized values
The methods
category holds functions that mutate data
...etc.
What are logical concerns?
Logical concerns are categories that describe what your code does.
Each feature in your setup
or composition function is a logical concern
Concerns change for every function
There's no limit to the number of concerns you can have in a given function
Why organize by logical concern?
Why organize by options?
🙂 Fewer "where the F's?" initially
🤮 Over time, "where the F?" count grows steadily
Why organize by logical concern?
😖 Plenty of "where the F's?" initially
🤩 Over time, "where the F?" count stays low
How do we organize by logical concern?
How?
The three listboxes
- Chancen International
- Dost
- Educate Girls
- Food 4 Education
- Imagine Worldwide
- Lively Minds
- Luminos Fund
- Ubongo
- Aceli Africa
- Babban Gona
- Digital Green
- Farmerline
- Hello Tractor
- Ignitia
- Kheyti
- Komaza
- Mountain Hazelnuts
- MyAgro
- One Acre Fund
- Precision Agriculture for Development
- Proximity Designs
- Pula
- West African Rice Company
- BOMA Project
- Bridges to Prosperity
- The/Nudge
- VisionSpring
- Amani Global Works
- Development Media International
- Equalize Health
- Friendship Bench
- Healthy Learners
- Integrate Health
- Intelehealth
- Last Mile Health
- Living Goods
- Lwala
- Medic
- Muso
- Nexleaf Analytics
- No Means No Worldwide
- Noora Health
- One Heart Worldwide
- PIVOT
- Sanku
- SaveLIFE Foundation
- Semilla Nueva
- StrongMinds
- THINKMD
- Turn
- VillageReach
- Young1ove
- mothers2mothers
- EarthEnable
- Saha Global
- Sanergy
- WSUP
- Blue Ventures
- COMACO
- Foundation for Ecological Security
- Gaia Amazonas
- Global Forest Watch
- Maliasili
- Nia Tero
- Zola Electric
Options API
- Chancen International
- Dost
- Educate Girls
- Food 4 Education
- Imagine Worldwide
- Lively Minds
- Luminos Fund
- Ubongo
- Aceli Africa
- Babban Gona
- Digital Green
- Farmerline
- Hello Tractor
- Ignitia
- Kheyti
- Komaza
- Mountain Hazelnuts
- MyAgro
- One Acre Fund
- Precision Agriculture for Development
- Proximity Designs
- Pula
- West African Rice Company
- BOMA Project
- Bridges to Prosperity
- The/Nudge
- VisionSpring
- Amani Global Works
- Development Media International
- Equalize Health
- Friendship Bench
- Healthy Learners
- Integrate Health
- Intelehealth
- Last Mile Health
- Living Goods
- Lwala
- Medic
- Muso
- Nexleaf Analytics
- No Means No Worldwide
- Noora Health
- One Heart Worldwide
- PIVOT
- Sanku
- SaveLIFE Foundation
- Semilla Nueva
- StrongMinds
- THINKMD
- Turn
- VillageReach
- Young1ove
- mothers2mothers
- EarthEnable
- Saha Global
- Sanergy
- WSUP
- Blue Ventures
- COMACO
- Foundation for Ecological Security
- Gaia Amazonas
- Global Forest Watch
- Maliasili
- Nia Tero
- Zola Electric
Composition API, organized by options
- Chancen International
- Dost
- Educate Girls
- Food 4 Education
- Imagine Worldwide
- Lively Minds
- Luminos Fund
- Ubongo
- Aceli Africa
- Babban Gona
- Digital Green
- Farmerline
- Hello Tractor
- Ignitia
- Kheyti
- Komaza
- Mountain Hazelnuts
- MyAgro
- One Acre Fund
- Precision Agriculture for Development
- Proximity Designs
- Pula
- West African Rice Company
- BOMA Project
- Bridges to Prosperity
- The/Nudge
- VisionSpring
- Amani Global Works
- Development Media International
- Equalize Health
- Friendship Bench
- Healthy Learners
- Integrate Health
- Intelehealth
- Last Mile Health
- Living Goods
- Lwala
- Medic
- Muso
- Nexleaf Analytics
- No Means No Worldwide
- Noora Health
- One Heart Worldwide
- PIVOT
- Sanku
- SaveLIFE Foundation
- Semilla Nueva
- StrongMinds
- THINKMD
- Turn
- VillageReach
- Young1ove
- mothers2mothers
- EarthEnable
- Saha Global
- Sanergy
- WSUP
- Blue Ventures
- COMACO
- Foundation for Ecological Security
- Gaia Amazonas
- Global Forest Watch
- Maliasili
- Nia Tero
- Zola Electric
Composition API, organized by logical concern
Tactics for organizing by logical concern
Tactics 🎯
Often, each data
and computed
property is the foundation of a separate logical concern. Create a section for each one.
Within sections, start with reactive state, then write methods, then write side effects.
Avoid the temptation to mix concerns inside watchers, lifecycle hooks, and event handlers.
Be consistent.
Bonus: organize template-related code by logical concern.
The fourth listbox
- Chancen International
- Dost
- Educate Girls
- Food 4 Education
- Imagine Worldwide
- Lively Minds
- Luminos Fund
- Ubongo
- Aceli Africa
- Babban Gona
- Digital Green
- Farmerline
- Hello Tractor
- Ignitia
- Kheyti
- Komaza
- Mountain Hazelnuts
- MyAgro
- One Acre Fund
- Precision Agriculture for Development
- Proximity Designs
- Pula
- West African Rice Company
- BOMA Project
- Bridges to Prosperity
- The/Nudge
- VisionSpring
- Amani Global Works
- Development Media International
- Equalize Health
- Friendship Bench
- Healthy Learners
- Integrate Health
- Intelehealth
- Last Mile Health
- Living Goods
- Lwala
- Medic
- Muso
- Nexleaf Analytics
- No Means No Worldwide
- Noora Health
- One Heart Worldwide
- PIVOT
- Sanku
- SaveLIFE Foundation
- Semilla Nueva
- StrongMinds
- THINKMD
- Turn
- VillageReach
- Young1ove
- mothers2mothers
- EarthEnable
- Saha Global
- Sanergy
- WSUP
- Blue Ventures
- COMACO
- Foundation for Ecological Security
- Gaia Amazonas
- Global Forest Watch
- Maliasili
- Nia Tero
- Zola Electric
Bonus!
Bye!
Find the talk notes at talks.alexvipond.dev
📖Link to new ebook, Rethinking Reusability in Vue, expanding on this talk's ideas
🔗Link to git repo for this talk's code
📽️A live copy of this slideshow, including live demos of the listboxes
📹Links to videos on related concepts, like function refs