ENTRIES TAGGED "git"

How to (semi-)automate JavaScript refactoring

Disposable robot assassins and spreadsheets

Computers aren’t ready to write much of our code for us, but they can still help us clean and improve our code.

At Fluent 2013, O’Reilly’s Web Platform, JavaScript and HTML5 conference, Giles Bowkett demonstrated a wide variety of ways to write code that helps refactor code, showing developers a variety of ways to clean up and simplify their JavaScript. He gave ‘disposable robot assassin at large’ as his title, but it fit better with the code he was demonstrating.

Bowkett explored many options and iterations of his automation ideas,

  • The roots: Martin Fowler’s classic Refactoring. [at 00:50]
  • “Probably the first time ever you see a developer or hacker enthusiastic about using a spreadsheet… I am that fluke.” [at 01:48]
  • Matching method names with the ack and wc Unix command line utilities, and finding some useless methods. [at 5:58]
  • “More complex information… surfacing an implicit object model.” [at 7:45]
  • Filter scripts and text streams [at 14:45]
  • “Towlie, because it liked to make things DRY”, using similarity detection in Ruby. [at 16:37]
  • Building on JSLint [at 20:10]
  • Switching to a Ruby parser for JavaScript to calculate differences [at 21:49]
  • JavaScript parsers: Esprima [at 27:26]
  • “Have script that… tells you this file is the one that people have edited most frequently. [at 30:29]
  • Grepping through git history [at 32:53]
  • “Automatic refactoring will let you get to better code much faster.” [at 36:25]

It’s an amazing mix of capabilities that let you build your own robot (code) assassins.

If the Web Platform, JavaScript, and HTML5 interest you, consider checking out our growing collection of top-rated talks from Fluent 2013.

Comment |

Code Carabiners: Essential Protection Tools
for Safe Programming

Assertions, regression tests, and version control

Programming any non-trivial piece of software feels like rock climbing up the side of a mountain. The larger and more complex the software, the higher the peak.

You can’t make it to the top in one fell swoop, so you need to take careful steps, anchor your harnesses for safety, and set up camp to rest. Each time you start coding on your project, your sole goal is to make some progress up that mountain. You might struggle a bit to get set up at first, but once you get going, progress will be fast as you get the basic cases working. That’s the fun part; you’re in flow and slinging out dozens of lines of code at a time, climbing up that mountain step by steady step. You feel energized.

However, as you keep climbing, it will get harder and harder to write each subsequent line. When you run your program on larger data sets or with real user inputs, errors arise from rare edge cases that you didn’t plan for, and soon enough, that conceptually elegant design in your head gives way to a tangled mess of patches and bug fixes. Your software starts getting brittle and collapsing under its own weight.

Read more…

Comment |

Restructuring the Web with Git

Can version control manage content?

Web designers? Git? Github? Aren’t those for programmers? At Artifact, Christopher Schmitt showed designers how much their peers are already doing with Github, and what more they can do. Github (and the underlying Git toolset) changes the way that all kinds of people work together.

Sharing with Git

As amazing as Linux may be, I keep thinking that Git may prove to be Linus Torvalds’ most important contribution to computing. Most people think of it, if they think of it at all, as a tool for managing source code. It can do far more, though, providing a drastically different (and I think better) set of tools for managing distributed projects, especially those that use text.

Git tackles an unwieldy problem, managing the loosely structured documents that humans produce. Text files are incredibly flexible, letting us store everything from random notes to code of all kinds to tightly structured data. As awesome as text files are—readable, searchable, relatively easy to process—they tend to become a mess when there’s a big pile of them.

Read more…

Comment: 1 |

New school C

Why C is a more practical and enticing programming language than you might think.

Choosing a programming language for that project you’re working on is a fairly straightforward decision: it needs to be fast, easy to use, and it must come with enough bells and whistles to keep you from re-inventing the wheel every time you want to do something.

Looking at this criteria, aside from the fast bit, the C language may not be the first one that pops into your head. After sitting down with Ben Klemens, the author of 21st Century C, I am now looking at C as a more practical and enticing alternative than I would have thought possible.

21st Century C sets a precedent in presenting C as a language that is a lot easier to use, and has more library support than many people think. If you are not up to date on the latest that C has to offer you may not be aware of the simplicity and elegance of the language. These strengths are backed by the C99 and C11 standards, but mainly they are built up on the development of libraries and modern tools for building and multi-threading in C. Read more…

Comments: 9 |

Inside GitHub’s role in community-building and other open source advances

An interview with Matthew McCullough

In this video interview, Matthew McCullough of GitHub discusses what they’ve learned over time as they grow and watch projects develop there.

Read more…

Comment: 1 |

Dell’s Sputnik – Git what you want

Git what you need, not what you get.

In 1957, the former Soviet Union launched an unmanned satellite call Sputnik. That launch catalyzed a political, military, technological, and scientific race to superiority between the U.S.S.R. and the United States. More than fifty years later, Dell Inc. has launched its own “Sputnik.”

The centerpiece of the program is a Dell XPS-13 “ultrabook” that comes with Ubuntu 12.04 LTS installed. It has 3.6 GiB of Memory with Intel® Core™ i7-2637M CPU @ 1.70GHz × 4 Processor, 251.6 Gigabytes of disk space and a 64-bit OS. Like its namesake, Dell is hoping this project creates an ultrabook-race for developers’ computing needs. From my perspective, they are off to a great start.

Read more…

Comments: 6 |
Jon Loeliger offers some practices to use with Git

Jon Loeliger offers some practices to use with Git

Advice from author of "Version Control with Git."

After finishing the second edition of "Version Control with Git," author Jon Loeliger talked to O'Reilly editor Andy Oram about how to use Git effectively as changes to code pile up.

Comment |
Developer Week in Review: Google I/O’s ticket window opens and shuts in record time

Developer Week in Review: Google I/O’s ticket window opens and shuts in record time

Google I/O reg disappoints many, Microsoft shares, and happy birthday to gcc.

Google I/O registration was there and gone so fast you might have missed it if you blinked, Microsoft is sharing more of its code Apache-style, and the leading compiler package in the world celebrates a milestone.

Comment |
Developer Week in Review: Mobile’s embedded irony

Developer Week in Review: Mobile’s embedded irony

Who really profits from Android sales? And does the world need another source control system?

Microsoft profits from Google's toils, why you shouldn't put older developers out to pasture, and a new source control system enters the fray.

Comment: 1 |
Developer Week in Review

Developer Week in Review

App Store policy makes developers see red, Ubuntu may have a black heart, and a look at the blue content in git commits.

Coming up on the Week in Review: Revolt of the App Store developers, Ubuntu's innocence lost, and a report we swear you'll like.

Comments: 3 |