8 ms·
When I was hired on the Watson team, the first thing they asked me to do was help improve performance of their AngularJS-based website. It was all-around slow,
by nfriedly 10y ago
When I was hired on the Watson team, the first thing they asked me to do was help improve performance of their AngularJS-based website. It was all-around slow, especially for the initial page view. I stripped out AngularJS and most of the other JavaScript, and published a website that was almost pure static HTML. It loaded very quickly. My manager thought it was hilarious - his "JavaScript expert" came in and deleted all of the JavaScript.
- larrik 10y agoAs a developer, I find more pleasure in deleting code than writing it. It might have been hilarious, but I wasn't surprised to read that :)
- agumonkey 10y agoMore than hilarious, I find it a serious skill manifestation.
- klodolph 10y agoA large percentage of the "very skilled" developers I know will much sooner brag about how much code they deleted or didn't write than how much code they wrote.
- agumonkey 10y agoThat is already well known quality[1]. I find Parent work even deeper, he pivoted the whole thing to make his main skill a second class citizen because that's what it was to be in this context. [1] I regularly nerdgasm at LibreOffice releases reading how many thousands LoC they removed from the code base. ps: beside code golf, I think there should be a patch golf thing. Try the smallest changeset that fixes or add a feature.
- Roboprog 10y agoI like the idea of "patch golf". If only people would at least do a diff before they commit to spot gratuitous reformatting or accidental changes :-(
- agumonkey 10y agoThat's the exact reason I thought of it [1]. With "large" code base, every character impacts the project, patch size becomes a skill. That said, it's so tempting to fix multiple almost related things in one go. [1] also, git surgically precise patch mindset helped too.
- Mc_Big_G 10y agoA very proud moment for me recently was when someone ran git stats and it showed I'd deleted more code than I'd written. It was glorious.
- nkassis 10y agoLazyness is a virtue for software engineers in my opinion.
- marktangotango 10y agoGenerally when I hear people talk about having imposter syndrome in software development, I feel like they're missing this key insight. The fastest code, and the easiest to maintain is the code that's never written. I've been trying to formulate how to express this idea to people who don't have it ie paraphrasing YAGNI: "Strive to optimize for less code, and the minimum level of abstraction."
- yclge 10y ago"Strive to optimize for less code, and the minimum level of abstraction." That should be the appropriate level of abstraction. The appropriate level of abstraction being that which requires the least code to implement and least effort to reason about.
- marktangotango 10y agoI think "appropriate" is highly subjective. The problem is developers seeking to impress their peers with over abstraction of trivial things. I personally think "minimal" is more "enforcable" ie easier to convey in a code review comment for example. Again, imo.
- acconrad 10y agoI did just that same thing for a client. They were using React to make 1 AJAX request to Foursquare. The thousands of lines of code turned into 22 lines of vanilla Javascript. I was shocked.
- G3E9 10y agoOr when a project includes jQuery for a single AJAX call - someone somewhere got paid for that ridiculous insight.
- matchagaucho 10y agoGiven "fetch" is not yet a standard, jQuery $.ajax is actually a decent cross-browser polyfill.
- favorited 10y agoI've been out of the JS world for a few years, but for a single Ajax call, why wouldn't you use XMLHttpRequest?
- matchagaucho 10y agojQuery ajax essentially is just a wrapper to XMLHttpRequest. With some effort, the relevant jQuery methods that act as polyfills could be extracted. However, a minified version of core jQuery is < 20Kb. A very low technical debt trade-off to support 99% of browsers.
- truth_sentinell 10y agoWhy would you care about IE8 - 9 or whatever other browser you might be thinking about that has probably an infinitesimal market share?
- Whitestrake 10y agoMarket share might be a ridiculously small percentage overall, but it's never appropriate to dismiss compatibility outright. Reasons to include inefficient code for compatibility reasons might include applications where maximum reach is valuable, or where the scale is so large that the "infinitesimal market share" percentage plays out into thousands of end users.
- wackro 10y ago"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger." - Dijkstra
- nkassis 10y agoI've had interview candidates for frontend developer positions who only know how to build web pages using frameworks like Angular and React. They don't seem to understand how those frameworks work but essentially patch together a bunch of example online to get something going. It's truly unfortunate that many beginner web development tutorial introduce these technologies first in my view. Without giving new developers understanding basics of the web platform they get siloed into only knowing one way to do things and it results in using the wrong tools for the job as this example shows.
- noobermin 10y agoHere's another perspective. I started learning JS in reverse and ended up just creating my own framework because it was less verbose. But you would hire me over your patch-and-patch fellows? Perhaps the right answer is to code know the basics but also have a handle on the popular frameworks too.
- nkassis 10y ago"Here's another perspective. I started learning JS in reverse and ended up just creating my own framework because it was less verbose. But you would hire me over your patch-and-patch fellows?" Yes more likely. In fact I would find informative to see the framework that you have built as an example of understanding web development. To expand a bit I think learning the framework is easier once you have an understanding of the web platform's basic. For non web stuff I value more problem solving ability, general CS knowledge over specific technology knowledge. I usually don't set a language requirements in interviews and look more to someone being able to explain how the code they wrote works and why it's a better solution than say some inefficient brute force method. Which in my example when applied to web stuff would translate to why is implementing something this way in angular better than an alternative, what advantages did you gain from angular. Etc...
- __s 10y agoMy framework looks like this: https://github.com/serprex/openEtG/blob/master/dom.js https://github.com/serprex/openEtG/blob/master/dom.js The code that uses it looks like this: https://github.com/serprex/openEtG/blob/master/views/MainMenu.js https://github.com/serprex/openEtG/blob/master/views/MainMen... The site looks like this: http://etg.dek.im http://etg.dek.im I recently worked on a site at my job where I was able to implement it with JS + C#/OWIN, all static html, only uses toastr/jquery. Was nice they let me break away from the illusion that the choice is only between WebForms or MVC If you ask me to compare this to Angular, I'd have to say I've never used Angular so I don't know
- 20years 10y agoI would say that is what makes you truly a "JavaScript expert". Knowing when to use it and when not to but most importantly knowing how to implement alternative solutions when needed. It would be cool to see the before (with AngularJS) & after (pure HTML) of this.
- AffluentApe 10y agoI've been a Frontend Dev for almost 5 years now. I feel a large part of performance is knowing when and where to remove unnecessary JS.
- DarkTree 10y agoEvery time I read about the original "hackers" of the modern computer era, it seems many were much more focused on refining their code, or "bumming" lines of code, into the smallest form possible due to the technological limitations of the time. It's not super surprising many developers aren't as conscientious about bloating software because computers have gotten fast enough to mask a lot of performance issues. Still, I think those who strive for less code show maturity as a developer. For one, you can't remove lots of code if you don't truly know how the code works, and furthermore, that process is a good way to learn how it does.
- auxbuss 10y agoThere's a name for that: https://en.wikipedia.org/wiki/Wirth%27s_law https://en.wikipedia.org/wiki/Wirth%27s_law
- saschaleib 10y agoI just sent an email to my "favourite customer", recommending that they hire you!
- svennv 10y agoOf course: The important thing about a tool is not just to know how to use it, but also when and when not to. Nice example.