• Save
Tools and Techniques for Faster Development
Upcoming SlideShare
Loading in...5
×
 

Tools and Techniques for Faster Development

on

  • 41,306 views

We'll walk through the process of building an application and solving the typical problems you might encounter along the way. Find out what tools and techniques work best for each class of problem and ...

We'll walk through the process of building an application and solving the typical problems you might encounter along the way. Find out what tools and techniques work best for each class of problem and learn some shortcuts and tips along the way. We'll mainly cover mobile web development, Chrome Canary, and OS X tools. Difficulty level: Beginner to Intermediate.

Statistics

Views

Total Views
41,306
Views on SlideShare
40,854
Embed Views
452

Actions

Likes
65
Downloads
0
Comments
2

18 Embeds 452

http://us-w1.rockmelt.com 98
https://si0.twimg.com 93
http://blog.websourcing.fr 61
http://www.scoop.it 54
http://hypeway.com 54
https://twimg0-a.akamaihd.net 31
https://twitter.com 29
http://localhost 8
http://tweetedtimes.com 7
http://www.netvibes.com 4
http://www.twylah.com 3
http://a0.twimg.com 3
http://192.168.1.2 2
http://www.crowdlens.com 1
http://reader.googleusercontent.com 1
http://feeds.feedburner.com 1
http://tequid.com 1
http://pinterest.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Hey everyone, my name is Majd Taby, I’m a software engineer at Facebook and I'll be showing you some tools and techniques that can hopefully speed up your development process.\n\nThe bulk of the talk will discuss debugging techniques. In any development cycle, you spend only a fraction of your time writing code. More time is spent thinking and designing and architecting the system, but I posit that even more time is spent debugging issues and inspecting the app in the process of building it. Debugging time is the low-hanging fruit of programmer efficiency. Sure, a new text editor that can save you 15 keystrokes over 1 hour of usage is cool, but it doesn't help speed up your development. Cutting down your daily debugging time from 1 hour to 30 minutes though, means a lower national divorce rate.\n
  • \n
  • \n
  • So, why am I standing here today? Well, a few months I wrote a blog post that walked through the webkit inspector and it got a very positive reception, and Alex asked me to come talk a bit more about it. So here I am, trying to summarize the 6,000+ words of the blog post, highlight the takeaways, talk about some new features, and expand on some techniques. In my opinion, debugging a web application without using the webkit inspector is like taking a knife to a gun fight. I'll try to summarize common problems and efficient solutions to them.\n\nYou can use the blog post as a reference point for most of the inspector features I’m going to discuss today.\n
  • The talk will be split in two parts. The first will discuss debugging techniques and an analysis of often overlooked features and why they’re useful, then we’ll talk about some tools and workflow improvements that will hopefully increase your efficiency.\n
  • The talk will be split in two parts. The first will discuss debugging techniques and an analysis of often overlooked features and why they’re useful, then we’ll talk about some tools and workflow improvements that will hopefully increase your efficiency.\n
  • Debugging on the web can be split into four main parts: Debugging the DOM (both hierarchy and CSS), JavaScript, Network, and Performance. They follow the general app development process. First you get something on screen, then you give it some behavior, then you link it to a backend, then you make sure it’s fast.\n
  • Debugging on the web can be split into four main parts: Debugging the DOM (both hierarchy and CSS), JavaScript, Network, and Performance. They follow the general app development process. First you get something on screen, then you give it some behavior, then you link it to a backend, then you make sure it’s fast.\n
  • Debugging on the web can be split into four main parts: Debugging the DOM (both hierarchy and CSS), JavaScript, Network, and Performance. They follow the general app development process. First you get something on screen, then you give it some behavior, then you link it to a backend, then you make sure it’s fast.\n
  • Debugging on the web can be split into four main parts: Debugging the DOM (both hierarchy and CSS), JavaScript, Network, and Performance. They follow the general app development process. First you get something on screen, then you give it some behavior, then you link it to a backend, then you make sure it’s fast.\n
  • Before we start though, there are a few settings which may be of interest for you\n
  • Settings are accessible via the gear icon in the bottom left of the inspector. The first one I recommend enabling is Dock to right. This works great when you’re on a widescreen monitor since you are more constrained vertically than horizontally.\n\nUnless you’re debugging cache, you probably want to save yourself the headache and disable it too.\n\nEmulate touch events is one of my favourite additions recently. Instead of sending mouse events, it sends their touch equivalents. So touchstart intsead of mousedown, and touchend instead of mouseup. I only wish they’d add some sort of multi-touch support too. On a similar note, Override device metrics is great when you’re building a mobile web app and want to test what the app/site look like in their native resolution.\n
  • Settings are accessible via the gear icon in the bottom left of the inspector. The first one I recommend enabling is Dock to right. This works great when you’re on a widescreen monitor since you are more constrained vertically than horizontally.\n\nUnless you’re debugging cache, you probably want to save yourself the headache and disable it too.\n\nEmulate touch events is one of my favourite additions recently. Instead of sending mouse events, it sends their touch equivalents. So touchstart intsead of mousedown, and touchend instead of mouseup. I only wish they’d add some sort of multi-touch support too. On a similar note, Override device metrics is great when you’re building a mobile web app and want to test what the app/site look like in their native resolution.\n
  • Settings are accessible via the gear icon in the bottom left of the inspector. The first one I recommend enabling is Dock to right. This works great when you’re on a widescreen monitor since you are more constrained vertically than horizontally.\n\nUnless you’re debugging cache, you probably want to save yourself the headache and disable it too.\n\nEmulate touch events is one of my favourite additions recently. Instead of sending mouse events, it sends their touch equivalents. So touchstart intsead of mousedown, and touchend instead of mouseup. I only wish they’d add some sort of multi-touch support too. On a similar note, Override device metrics is great when you’re building a mobile web app and want to test what the app/site look like in their native resolution.\n
  • Settings are accessible via the gear icon in the bottom left of the inspector. The first one I recommend enabling is Dock to right. This works great when you’re on a widescreen monitor since you are more constrained vertically than horizontally.\n\nUnless you’re debugging cache, you probably want to save yourself the headache and disable it too.\n\nEmulate touch events is one of my favourite additions recently. Instead of sending mouse events, it sends their touch equivalents. So touchstart intsead of mousedown, and touchend instead of mouseup. I only wish they’d add some sort of multi-touch support too. On a similar note, Override device metrics is great when you’re building a mobile web app and want to test what the app/site look like in their native resolution.\n
  • Settings are accessible via the gear icon in the bottom left of the inspector. The first one I recommend enabling is Dock to right. This works great when you’re on a widescreen monitor since you are more constrained vertically than horizontally.\n\nUnless you’re debugging cache, you probably want to save yourself the headache and disable it too.\n\nEmulate touch events is one of my favourite additions recently. Instead of sending mouse events, it sends their touch equivalents. So touchstart intsead of mousedown, and touchend instead of mouseup. I only wish they’d add some sort of multi-touch support too. On a similar note, Override device metrics is great when you’re building a mobile web app and want to test what the app/site look like in their native resolution.\n
  • So, moving on to the DOM\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The Elements panel is where you do your DOM debugging. It’s split up into three parts: the dom inspector, css editor, and the element properties. Let’s go over them\n
  • The two main features of interest in the dom inspector are the ability to rearrange nodes and edit attributes. Here’s how they work\n
  • The two main features of interest in the dom inspector are the ability to rearrange nodes and edit attributes. Here’s how they work\n
  • \n
  • The CSS Editor is one of my favorite features. It allows you to rapidly fix problems, see them fixed, and then apply the styles. I want to highlight the number editor, color picker and pseudo selectors for this talk though\n
  • The CSS Editor is one of my favorite features. It allows you to rapidly fix problems, see them fixed, and then apply the styles. I want to highlight the number editor, color picker and pseudo selectors for this talk though\n
  • The CSS Editor is one of my favorite features. It allows you to rapidly fix problems, see them fixed, and then apply the styles. I want to highlight the number editor, color picker and pseudo selectors for this talk though\n
  • \n
  • \n
  • One last tip before we move on, $0...$9 represent a history of nodes you’ve selected\n
  • \n
  • Metrics and event listeners are also really handy, especially when you’re trying to fix positioning or event bugs.\n
  • Metrics and event listeners are also really handy, especially when you’re trying to fix positioning or event bugs.\n
  • \n
  • \n
  • \n
  • So you’ve got your UI looking bright and shiny, but your behavior is messed up.\n
  • The Sources panel (née Scripts) is going to be your new best friend. It includes a file browser, code editor, tab support, breakpoints, watch expressions, and call stacks.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Now that it’s responding properly, let’s talk about the network.\n
  • Waterfall is a term used to describe the cascading nature of network requests. Each request incurs a latency hit, then a download hit. You want to minimize the number of requests your app has to make. The steeper your waterfall, the less people have to wait to use your app, and well all know startup perf has dramatic impacts on engagement and retention!\n
  • It’s important to note, 3G is a high latency, high bandwidth network, so optimize for round trips, not download size\n
  • The inspector tries to help you out here by laying out the waterfall visually, separating latency and download time, and providing some HTTP introspection as wells\n
  • Note the blue line. That line needs to be pushed as far left as you can. It’s the line that fires the DOMContentLoaded event which means that JS has finished downloading, and you’re ready to bring your app to life\n
  • Now, as you’re building your app, you’ll probably end up making some extra HTTP requests. Clicking on any request in the sidebar will show you a list of all the request and response headers and lets you preview the response if it was JSON. You no longer need to install a shitty java app or an unreadable CLI to inspect your network!\n
  • DOM’s done, JavaScript is working, and XHRs are firing. You’re still not done yet. As your animation runs, you notice glitches. Things are slogging along instead of sliding. This is where you start analyzing your performance (which you should’ve been doing all along anyway)\n
  • They ran a test where they flickered a screen between black and white and they progressively increased the frequency of the flickr. At about 60 FPS, the eye stopped perceiving the flickr, and the screen appeared to be gray. This suggests that for anything that moves on your page to appear smooth and continuous, it needs to run at 60 FPS. So how do we speed up the process of finding out why your animations are running < 60 FPS?\n
  • The Timeline panel was recently updated with a new “Frames” feature. Previously, the Timeline would only show you a history of what happened and how long it took, but you had to infer that it was causing a delay, and you didn’t know how much. A frame in this context, is a single visual refresh. In other words, you make a change to the background color, the browser applies that to the layer tree, and when the screen has finished rendering, then you get a chance to do more work. \n
  • If you notice on the top right, the timeline panel includes helpful guildes to show you when a frame (represented by a blank rectangle), is taking 60 fps. Ideally, all your frames will be on or below that line. If they’re not, you can click-drag in the visualization to narrow it down to a single frame, and can actually inspect exactly what’s happening during that time.\n
  • One other problem to keep in mind when making sure your app feels responsive is to track its memory usage. The greater JS community has largely neglected memory perf since web sites never really got to the level of complexity where it became a problem. That’s not true anymore, and the more object allocation you go through, the more GC cycles you go through, and the more glitches you see in your animation.\n
  • This is an almost ideal graph of what you should strive to make your memory profile look like. It’s a sawtooth function, where a GC cycle will clear all unused memory. Notice how the troughs here in the graph have a slight upward slope. That indicates a memory leak: As the GC runs, it doesn’t get back to the previous run, and the area under the graph grows.\n
  • To Recap...\n
  • To Recap...\n
  • To Recap...\n
  • To Recap...\n
  • You may be wondering, can I use all this awesomeness for my mobile web apps? Well, The answer is yes and no\n
  • Compare what we have available for us on the desktop\n
  • \n
  • to what we have on mobile\n
  • The dreaded iOS console. Utterly unhelpful. No lines, no actual error, no help at all\n
  • Then there’s weinre. It doesn’t include the “Sources” panel, and it includes a very old version of the insepctor\n
  • Then there’s iWebInspector. This one is better, but the tools are still very outdated, and every time you refresh the page, you need to reconnect.\n
  • clearly, mobile web debugging sucks\n
  • however, very recently a few better solutions have come up\n
  • The WebKit project recently announced support for the remote inspector protocol, and Chrome for Android was the first mobile browser to support it. This is the ideal solution: Real tools, running on real hardware, in realtime. The problem is it takes some setup to get going\n
  • iOS 6’s MobileSafari which hasn’t yet come out also supports the remote inspector. This one is much easier to get to, available as a menu option in the Develop menu (so I’ve read online)\n
  • Finally, one of my coworkers, Thomas Aylott recently open sourced a little app he’s been working on which acts as a wrapper around the remote inspector protocol\n
  • Here’s what it looks like: essentially the tools, with a sidebar\n
  • The main advantages this app provides are automatic device discovery, so you don’t need to run any commands in Terminal nor dig through menus, the latest dev tools, and on-device development: Refresh the tools, the page on the device refreshes.\n
  • The main advantages this app provides are automatic device discovery, so you don’t need to run any commands in Terminal nor dig through menus, the latest dev tools, and on-device development: Refresh the tools, the page on the device refreshes.\n
  • The main advantages this app provides are automatic device discovery, so you don’t need to run any commands in Terminal nor dig through menus, the latest dev tools, and on-device development: Refresh the tools, the page on the device refreshes.\n
  • The main advantages this app provides are automatic device discovery, so you don’t need to run any commands in Terminal nor dig through menus, the latest dev tools, and on-device development: Refresh the tools, the page on the device refreshes.\n
  • \n
  • So that concludes the first and main part of the talk. Now I’m going to quickly go through some tools that I’ve found to be really helpful while doing front-end JS work\n
  • First up is iTerm 2.0 I love this mainly for its splits feature, which i depend on. It support cmd-clicking on file names to open them in their respective apps, and supports a better search feature than the built-in Terminal app.\n
  • First up is iTerm 2.0 I love this mainly for its splits feature, which i depend on. It support cmd-clicking on file names to open them in their respective apps, and supports a better search feature than the built-in Terminal app.\n
  • First up is iTerm 2.0 I love this mainly for its splits feature, which i depend on. It support cmd-clicking on file names to open them in their respective apps, and supports a better search feature than the built-in Terminal app.\n
  • First up is iTerm 2.0 I love this mainly for its splits feature, which i depend on. It support cmd-clicking on file names to open them in their respective apps, and supports a better search feature than the built-in Terminal app.\n
  • here’s what a split terminal looks like. This is great when you have a build script running and want to monitor its output, while operating on the app. It works much nicer in a widescreen monitor.\n
  • Just a quick note. This is one of my favourite aliases ever. It graphically shows you your the git history of any branch. Here’s what it looks like\n
  • I love it because it shows me instantly what the state of my branches is, who’s been active, and how stale my repo is. I use this command 10-15 times a day and can’t live without it\n
  • \n
  • GitX is one of many git GUIs. There’s one and only one reason why I love working with GitX and is a stable member of my toolbet, and that’s line-by-line committing. This is something that you’ve always been able to do with git, but it’s hidden behind one of the most terrible CLI’s ever conceived. Another neat feature is that it makes context around your diffs easier to see. It’s a free app, and those two features mean that whenever I’m about to commit something bigger than a 2-3 line diff, I quickly pop into gitx\n
  • GitX is one of many git GUIs. There’s one and only one reason why I love working with GitX and is a stable member of my toolbet, and that’s line-by-line committing. This is something that you’ve always been able to do with git, but it’s hidden behind one of the most terrible CLI’s ever conceived. Another neat feature is that it makes context around your diffs easier to see. It’s a free app, and those two features mean that whenever I’m about to commit something bigger than a 2-3 line diff, I quickly pop into gitx\n
  • GitX is one of many git GUIs. There’s one and only one reason why I love working with GitX and is a stable member of my toolbet, and that’s line-by-line committing. This is something that you’ve always been able to do with git, but it’s hidden behind one of the most terrible CLI’s ever conceived. Another neat feature is that it makes context around your diffs easier to see. It’s a free app, and those two features mean that whenever I’m about to commit something bigger than a 2-3 line diff, I quickly pop into gitx\n
  • this is what the main interface looks like\n
  • this is the context slider. As you drag it, more or less of code surrounding your diffs will be shown.\n
  • This is the Unstages Changes view. Note how it’s split into two chunks already with their own “Stage” and “Discard” buttons. When I click on a single line, you notice it, too, gets its own Stage button\n
  • After I click on stage, notice how index.html appears both in Unstaged Changes and Staged changes. By the way, to unstage changes you just drag the file to the unstaged changes list. No need to remember reset vs checkout vs god-knows-wtf-linus-was-thinking\n
  • Once you commit, you get the hash and notice that index.html is still unstaged. This model is fantastic for breaking up unrelated changes into their own commits which can be reverted easily. Another nice side-benefit is that commit messages are much more contextual so ‘git blame’ becomes much more useful\n
  • \n
  • Finally, I’ve been using this tool for over 2 years now and it’s fantastic. It’s called xScope, from the folks at icon factory, and the two main features I constantly use are the ruler and the loupe.\n
  • Finally, I’ve been using this tool for over 2 years now and it’s fantastic. It’s called xScope, from the folks at icon factory, and the two main features I constantly use are the ruler and the loupe.\n
  • Finally, I’ve been using this tool for over 2 years now and it’s fantastic. It’s called xScope, from the folks at icon factory, and the two main features I constantly use are the ruler and the loupe.\n
  • Finally, I’ve been using this tool for over 2 years now and it’s fantastic. It’s called xScope, from the folks at icon factory, and the two main features I constantly use are the ruler and the loupe.\n
  • The loupe acts as a magnifying glass, allowing you to position and count pixels and pick up colors, and the ruler complements it really nicely and allows you to align elements and measure dimensions. Saves a lot of time.\n
  • \n
  • \n
  • \n
  • \n

Tools and Techniques for Faster Development Tools and Techniques for Faster Development Presentation Transcript

  • Tools and Techniquesfor Faster DevelopmentMajd Taby
  • Facebook@jtaby – jtaby.com
  • Overview
  • Debugging techniquesOverview
  • Debugging techniquesOverview Tooling and Workflow
  • DebuggingTechniques
  • DOMDebuggingTechniques
  • DOMDebugging JavaScriptTechniques
  • DOMDebugging JavaScriptTechniques Network
  • DOMDebugging JavaScriptTechniques Network Performance
  • Getting set up
  • Disable cache
  • Disable cacheDock to right
  • Disable cacheDock to rightEmulate touch events
  • Disable cacheDock to rightEmulate touch eventsOverride device metrics
  • Disable cacheDock to rightEmulate touch eventsOverride device metricsKeyboard shortcuts
  • Debugging the DOM
  • DOM Inspector CSS Editor Element Properties
  • DOMInspector
  • DOM Re-arrange nodesInspector
  • DOM Re-arrange nodesInspector Edit Attributes
  • CSS Editor
  • Double-click to editCSS Editor
  • Double-click to editCSS Editor Color Picker
  • Double-click to editCSS Editor Color Picker Pseudo Selectors
  • ElementProperties
  • Element MetricsProperties
  • Element MetricsProperties Event Listeners
  • Debugging JavaScript
  • Debugging the network
  • Waterfall
  • Latency > Bandwidth
  • Debugging performance
  • The flicker fusion point, where theeyes see gray instead of flickeringtends to be around 60 FPS. – Some guy on Wikipedia
  • DebuggingTechniques
  • DOMDebuggingTechniques
  • DOMDebugging JavaScriptTechniques
  • DOMDebugging JavaScriptTechniques Network
  • DOMDebugging JavaScriptTechniques Network Performance
  • What about the MobileWeb?
  • State of the Union –Desktop Edition
  • State of the Union –Mobile Edition
  • Mobile Web Debuggingsucks
  • A Better Solution
  • Remote InspectorChrome for Android
  • Remote InspectoriOS 6
  • Device RemoteInspectorby @subtleGradient
  • Automatic Device Discovery
  • Automatic Device DiscoveryLatest Chromium Dev Tools
  • Automatic Device DiscoveryLatest Chromium Dev ToolsTab Support
  • Automatic Device DiscoveryLatest Chromium Dev ToolsTab SupportOn-Device Development
  • https://github.com/subtleGradient/DeviceRemoteInspector.app
  • Tooling and Workflow
  • Splits
  • SplitsCMD-Click to Open
  • SplitsCMD-Click to OpenBetter search
  • alias gl="git log --graph --pretty=format:%Cred%h%Creset %C(cyan)%an%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset --abbrev-commit --date=relative"
  • iTerm 2.0iterm2.com
  • Line-by-line commit
  • Line-by-line commitDiff context
  • GitX (L)github.com/laullon/gitx
  • Rulers
  • RulersLoupe
  • RulersLoupeMirror
  • xScopeby Icon Factory – $29.99
  • Parting Thoughts
  • The worst kind of problem is the onewith an easy work-around
  • XOXOXO 😍@jtaby