Hello!
I am Mykola Kozhukharenko
front-end dev in Krusche & Company
I’m on Github
COMPONENT
driven
DEVELOPMENT
HOW-TO GUIDE
WHAT IS
CDD?
Process
of building UI from
very bottom
UP
IS IT NEW IN UI?
ATOMIC DESIGN
ATOMS MOLECULES
ORGANISM
TEMPLATE
- Duplicated functionality
- Block each other work
- Too many merge conflicts
- MR take too much time to be merged
- hard to find the place to start the task with
PROBLEMS TO
SOLVE:
WHAT IS THE
“COMPONENT”?
1.isolated (from business logic and
others)
2. easy to unit-test
3. look and behaves the same
throughout an app
- no side effects
- no margins
- small and clear API
4. Can be combined to create
new components, pages,
modules
HOW-TO
RULES TOOLSand
TOOLS
UI component explorers
tool #1
as an example:
Process
- Build components in isolation
- Specify state and stub data from within
your component’s directory
- Register it
UI component explorers
- React Storybook
- React Cosmos
- Carte Blanche
- React Styleguidist
- React Bluekit
- Electrode Explorer
- Vue-play
- Ember Freestyle
- Create your own
10k ★
2k ★
1.5k ★
1.8k ★
250 ★
200 ★
600 ★
180 ★
0 ★
OBVIOUS ADVANTAGE
- Sandbox for creating elements
- visualization for different comp. states
- easy to setup a docs/specification
UNOBVIOUS:
- force to think in terms of comp
- force to create smaller comp
- force to isolate comp
.fill-blanks-editor
.fill-blanks-editor__node
.fill-blanks-editor__node--is-multiple
.fill-blanks-editor__node--focused
.fill-blanks-editor__word
.fill-blanks-editor__word-content
CSS: NAMING CONVENTION
Tool #2
(OOCSS, ACSS, BEM, SMACSS)
const styles = style({
'default': {
card: {
background: this.props.background,
boxShadow: '0 2px 4px rgba(0,0,0,.15)',
},
},
})
<div style={ styles.card } />
OR CSS IN JS?
idiot proof
(wiki ru, en)
❝
RULES
One task - one
component - one PR
Rule #1
Keep it small
Display all possible
states
Rule #2
Isolate a component
Rule #4
develop it outside normal app
CODE REVIEW
Rule #4
check rules #1 #2 #3
Developers are lazy
❝
© someone
TOOLS RULES
We need a balance
WHY CDD?
- work in parallel
- easier to review and test
- new developers starts faster
- easier to maintain
- easier to setup css regression
testing
FRAMEWORK
DOESN’T MATTER
WHY NOT CDD?
- Time consuming
- treated as auxiliary project.
- seen as a tool for devs (not
business)
- it's often created after project
started
- One task - one component - one PR
- isolate it using component explorer
- cover all possible states at once
- code-review: ensure rules are followed!
HOW-TO
RULES
- Component explorer (Storybook, etc)
- BEM/css modules/css in js
HOW-TO
TOOLS
When to apply?
- There are 2+ FE developers
- The project is developing
continiously
Thanks!
Any questions?
You can find me at
twitter @mkozhukharenko

Nikolay Kozhukharenko ''Component driven development how to guide''