Is there a shortcut to becoming a developer 10x more valuable? If there was a magic secret that opened the door to a new, efficient world of software development, would you listen to it?

There are always doubters who say, “There is no easy way! Everyone needs practice to get better!” That’s true, but what exactly is the expert nature of software production? Is there one key detail that can make a huge difference in the development process?

Is!!! There are! But even if I were willing to share the secret, even give it to you and explain it in detail – it might still take 10 years of practice to fully appreciate this simple beauty.

This is something THAT HAPPENED to me. My high school programming teacher once told me about it in plain English. But it wasn’t until ten years later that I really understood what was behind it. Now, I finally appreciate the importance of this lesson, even though I know it’s just a lesson, and you can’t really experience what I want to share with you by watching it without doing it, so I’m walking you through the process of applying it step by step with some sample code.

This approach is the key difference between average productivity and 10x productivity. On the one hand, knowing that this approach gives you leverage during programming, you can increase efficiency by orders of magnitude. On the other hand, you can use this approach to write code that is more reusable and less likely to break when new requirements are introduced or when the surrounding code changes.

The secret to a tenfold increase in productivity is mastery of abstraction. Many developers see “abstract” as a dirty word. You often hear advice about code such as “don’t abstract” or Python’s claim to fame is that “explicit is better than implicit,” which means concrete is better than abstract. All of this is good advice (depending on the situation).

But modern applications tend to use a lot of code. If you printed out the source code for the top 10 modern applications, the paper would stack up to the height of a skyscraper and the software would be expensive to maintain. The more code you create, the more it costs.

Abstraction is the key to simple code

Proper abstractions can hide details that are not important to the current context and reduce the amount of code required to perform the same work (often by several orders of magnitude), making the code more readable, adaptable, and maintainable.

Abstraction is not a one-way street. It’s actually made up of two complementary concepts:

Generalization – Remove duplicate parts (obvious parts) and hide them behind the abstract parts.

Specialization — Apply abstractions to specific scenarios, adding only what is needed (what makes sense) at a time to address new requirements.

Please see the following code for suggestions: 🔗Gist.github.com/ericelliott…

There is nothing inherently wrong with the code, but it contains many details that may not be important for that particular application.

It contains details of the container/transport data structures (arrays) in use, and it has a state shape dependency, which means that it applies only to specific arrays and structures.

It contains iterative logic, which means that if you need to edit or add other operations, you have to access every element in the data structure, and even repeat very similar iterative logic in the code. This is no different from forcing repetition, which may violate the DRY principle (do not repeat your own code).

It represents an explicit assignment, and without a declarative description of the operation to be performed, the code becomes too verbose. None of this is necessary; all of this can be hidden behind the abstract. In this case, this general-purpose abstraction changes the way modern applications are built and reduces the number of for loops we need to write.

By using the Map operation, we can reduce the code to a single use case by removing the obvious code (meaning the repeated parts of similar code) and focusing the code on the meaningful code (meaning the parts of the code that differ) : 🔗Gist.github.com/ericelliott…

Some junior developers have a myth that they have to write a lot of code to generate a lot of value. Senior developers, by contrast, know the value of code without writing more.

Imagine that you, as a programmer, make extensive use of Map operations in a programming language like JavaScript, which has tremendous benefits. Because the Map provides details, such as the type of data you want to image, the type of structure that contains that data, and the iteration logic needed to enumerate each data node in the data structure. It has improved the efficiency of every application I’ve developed over the past decade.

Jeremy Ashkenas popularized this type of operation in JavaScript and expanded it into CoffeeScript, paving the way for many of the important syntactic shortcuts we now take for granted in JavaScript. In addition, he made Underscore and Backbone, Backscore’s creator of Lodash, which is by far the most popular functional programming utility in JavaScript, and Backbone popularized the MVC architecture in JavaScript. And laid the foundation for Angular and React.

John Resig made the very popular and influential jQuery, which formed a large collection of reusable, packaged JavaScript modules (jQuery plug-ins) that provided the standard for Node modules and ES6 modules a few years later. JQuery’s API is extremely influential and forms the basis of today’s DOM choice API. When I unit test the React component, I still benefit from the jQuery API almost every day. The right abstraction is a powerful lever that can greatly affect productivity. Abstract is not a derogatory word. Modules, functions, variables, classes – all of these are forms of abstraction in their own right, and their fundamental reason for existence is to simplify abstractions and their composition.

You can’t build complex software without abstraction. Even assembly language uses abstractions – instruction names, memory address variables, code points to which subroutines (such as function calls) jump. Modern software is applying abstract layers to the cake, and these layers provide you with leverage.

“Give me a lever long enough and a fulcrum to hold it, and I will move the earth.”

— Archimedes

The key to simplicity: The secret of our quest is how to reduce the amount of code we’re writing – how to get more done for less money. Once you’ve mastered this, I guarantee you’ll be 10 times more valuable as a programmer.

Eric Elliott is the author of Writing Software. As co-founder of EricElliottJS.com and DevAnywhere. IO, he teaches developers basic software development skills. He established and advised the development team on cryptographic projects and contributed software experience to Adobe Systems, Zumba Fitness, The Wall Street Journal, ESPN, BBC and top recording artists including Usher, Frank Ocean, and Metallica.

🔗 original link: medium.com/javascript-…

The above information comes from the network, edited by the “Jd Zhilian cloud developer” public number, does not represent the position of JD Zhilian cloud