SlideShare una empresa de Scribd logo
1 de 93
Descargar para leer sin conexión
React & The Art of Managing
Complexity
UI Engineer @ Netflix
@bittersweetryan
ryan.anklam@gmail.com
Complexity
http://photo.sf.co.ua/id41
Complexity
http://images.fineartamerica.com/images-medium-large/soyuz-tma-spacecraft-cockpit-detlev-van-ravenswaay.jpg
Complexity is using the wrong abstraction.
MVC is the wrong abstraction.
MVC is the wrong abstraction.
Small, single purpose components are the right
abstraction.
Welcome to the composable web!
What if I told you that markup, events, and handlers
should live side by side inside the component?
What if I told you that markup, events, and handlers
should live side by side inside the component?
Warning, ES6 ahead!
http://kangax.github.io/compat-table/es6/
class CurrentTime extends React.Component{
constructor( props ){
super( props );
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
class CurrentTime extends React.Component{
constructor(){
super();
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
ZOMG!!! Theres MARKUP in JavaScript!!!
class CurrentTime extends React.Component{
constructor(){
super();
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
Theres an onClick in your markup!!!
class CurrentTime extends React.Component{
constructor(){
super();
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
1994 Called, it want’s it’s JavaScript Back!
class CurrentTime extends React.Component{
constructor(){
super();
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
Go home Ryan, you’re drunk.
Your markup and JavaScript are inherently tightly
coupled.
There is a cost to context switching, even switching
from a “model” to a “view”.
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
function(){}
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
function(){}
function(){}
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
function(){}
function(){}
property: value
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
function(){}
function(){}
property: value
function(){}
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
module{}
function(){}
function(){}
property: value
function(){}
object{}
foo controller
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
foo view
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
foo view
<markup>
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
foo view
<markup>
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
<markup>
foo view
<markup>
bind:action
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
<markup>
http://commons.wikimedia.org/wiki/File:Programmer_writing_code_with_Unit_Tests.jpg
class CurrentTime extends React.Component{
constructor( props ){
super( props );
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
class CurrentTime extends React.Component{
constructor( props ){
super( props );
this.state = { clickCount : 0 };
}
handleClick(){
this.setState( {
clickCount : this.state.clickCount + 1
} );
}
render(){
return (
<button onClick={this.handleClick.bind( this )}>
Clicked {this.state.clickCount} times
</button>
);
}
};
What does this component look like?
Clicked 2 times
Complexity is the inability to quickly reason about
where application state is being changed.
Controller ViewModel
Controller View
View
Model
Controller View
View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Model
Controller View
View
Controller View
Controller View
Model
Controller View
View
Controller View
Controller View
Model
Controller View
View
Controller View
Controller View
Model
Model
Model
Controller View
View
Controller View
Controller View
Theres a bug on
our account page.
Model
Model
Model
Complexity is…mutability.
“The last thing you wanted any programmer to do is
mess with internal state…” Allan Kay - Creator of
Smalltalk
Immutability is the path to managing complexity.
https://www.youtube.com/watch?v=I7IdS-PbEgI
In React, a component’s props are immutable.
class Movie extends React.Component{
constructor( props ){
super( props );
}
render(){
return (
<div className="movie">
{this.props.name}
</div>
);
}
};
Movie.defaultProps = { name: 'Batman' };
React.render( <Movie name="The Dark Knight"/>, document.body );
React.render( <Movie name="The Dark Knight"/>, document.body );
Here be Dragons?
React.render(<Movie name={['The Dark Knight']}/>, document.body);
Here be Dragons?
Unpredictability is hidden complexity.
Remove that hidden complexity with PropTypes.
class Movie extends React.Component{
constructor( props ){
super( props );
}
render(){
return (
<div className="movie">
{this.props.name}
</div>
);
}
};
Movie.propTypes = { name: React.PropTypes.string };
Movie.defaultProps = { name: 'Batman' };
An application without any state changes would be
pretty boring.
A React component’s state property is mutable.
class CurrentTime extends React.Component{
constructor( props ){
super( props );
this.state = { currentTime : new Date() };
}
componentDidMount(){
this.interval = setInterval(() => {
this.setState( { currentTime : new Date() } );
}, 1000 );
}
render(){
return (
<div>{this.state.currentTime.toString()}</div>
);
}
};
Idiomatic React encourages using props as much as
possible.
How do we make our app interesting, while embracing
props?
class CurrentTime extends React.Component{
constructor( props ){
super( props );
}
render(){
return (
<div>{this.props.currentTime}</div>
);
}
};
class CurrentTimeController extends React.Component{
constructor(){
super();
this.state = { currentTime : new Date() };
}
componentDidMount(){
this.interval = setInterval( () => {
this.setState( { currentTime : new Date() } );
}, 1000 );
}
render(){
return (
<CurrentTime currentTime={this.state.currentTime.toString()} />
);
}
}
What about Events?
class FormController extends React.Component{
constructor( props ){
super( props );
this.state = { name : '' };
}
nameChangeHandler( value ){
this.setState( { name : value } );
}
render(){
return (
<div>
Hello, {this.state.name}
<NameInput name={this.state.name}
changeHandler={this.nameChangeHandler.bind(this)}/>
</div>
);
}
}
“There’s a bug on our account page, US users are
seeing € instead of $ for their plan price.”
//controller component for the account section
class AccountController extends React.Component{
constructor( props ){
super( props );
}
render(){
return(
<PlanInfo
streamingInfo={this.props.streamingInfo}
region={this.props.region} />
);
}
}
class PlanInfo extends React.Component{
constructor( props ){
super( props )
console.log( props );
}
getStreamingSection(){
if( this.props.streamingInfo ){
let streamingInfo = this.props.streamingInfo;
return ( <StreamingSection
streams={streamingInfo.streams}
price={streamingInfo.price}
region={this.props.region/>
);
}
}
render(){
let streamingPlan = this.getStreamingSection();
return (
<div>
{streamingPlan}
</div>
);
}
}
class StreamingSection extends React.Component{
constructor( props ){
super( props );
}
getFormattedPrice(){
let symbol =
( this.props.region === "US" ) ? '€' : '$';
return `${symbol} {this.props.price}`;
}
render(){
return (
<article>
<p>Streams: {`${this.props.streams} streams` }</p>
<p>Price: {this.getFormattedPrice()}</p>
</article>
);
}
}
Why was that easy?
Each component was small.
Each component did a single thing.
All the data was in immutable.
Sprinkles are for those who have code in prod.
http://www.dallasmomsanddads.com/wp-content/uploads/2013/04/photo-1.jpg
<div className={pinEntryClass}>
{accountVerify}
<h2 className="account-subheader parent-control-subheader">
{this.i18n['pin.page.subheader']}
</h2>
<p>{this.i18n['pin.page.info']}</p>
<PinPad
handleValidPinEntry={this.handleValidPinEntry}
handleInvalidPinEntry={this.handleInvalidPinEntry}
handleValidNumberEntry={this.handleValidNumberEntry}
ref="pinPad"
pin={this.state.pin}
enabled={this.state.pinEnabled} />
...
var pinProps = {
enabled: true,
handleValidNumberEntry: function(pin) {
newPin = pin; },
handleValidPinEntry: function() {
errorMessage.addClass('hidden');
buttonSave[0].disabled = false;
},
handleInvalidPinEntry: function() {
errorMessage.removeClass('hidden');
buttonSave[0].disabled = true;
}
};
React.render(pinPad(pinProps),
document.querySelector('.pin-pad-container'));
Now what?
Write some code!
http://facebook.github.io/react/docs/tutorial.html
jsbin.com
We are doing some pretty cool stuff with
JavaScript at Netflix. Please stop me in the halls
I’d love to share more of what we are doing!
Thank You!
@bittersweetryan

Más contenido relacionado

La actualidad más candente

High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
Nicholas Zakas
 

La actualidad más candente (20)

A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
Clojure Web Development
Clojure Web DevelopmentClojure Web Development
Clojure Web Development
 
State of the resource timing api
State of the resource timing apiState of the resource timing api
State of the resource timing api
 
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
 
PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
 
Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
 
High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
 
Service workers
Service workersService workers
Service workers
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
 
Testing Mobile JavaScript
Testing Mobile JavaScriptTesting Mobile JavaScript
Testing Mobile JavaScript
 
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
 

Similar a React & The Art of Managing Complexity

Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
vhazrati
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 

Similar a React & The Art of Managing Complexity (20)

Enhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order componentEnhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order component
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
 
OttawaJS - React
OttawaJS - ReactOttawaJS - React
OttawaJS - React
 
Lec7Handout.ppt
Lec7Handout.pptLec7Handout.ppt
Lec7Handout.ppt
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
React for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence ConnectReact for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence Connect
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
Intro react js
Intro react jsIntro react js
Intro react js
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
 
React lecture
React lectureReact lecture
React lecture
 
Functional UIs with Java 8 and Vaadin JavaOne2014
Functional UIs with Java 8 and Vaadin JavaOne2014Functional UIs with Java 8 and Vaadin JavaOne2014
Functional UIs with Java 8 and Vaadin JavaOne2014
 
React Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptxReact Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptx
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
React.js: You deserve to know about it
React.js: You deserve to know about itReact.js: You deserve to know about it
React.js: You deserve to know about it
 

Último

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

React & The Art of Managing Complexity