For most companies, the management should leave the recruitment of technical staff to the technical team, and only they can accurately judge the technical strength of candidates. If you happen to be a candidate, you will have to go to an interview sooner or later. No matter which side you are, let big brother teach you some moves.

Big brothers, if you want to collect, you should also like to pay attention to it.

With the person this

Excellent team is the key to determine the company’s performance. If a company wants to make progress in adversity, the most important thing is to cultivate an excellent team first.

As Marcus Lemonis says, the three ps are the most important:

People, Process, Product.

In the early days, you need to hire engineers who can stand on their own. He or she should be able to help recruit engineers, mentor other engineers, and solve problems for junior and intermediate engineers. You can’t have enough of these guys any time.

Pair programming is one of the best ways to assess the true caliber of a candidate.

Pair program with the candidate and do everything the candidate says. Observe and listen a lot to see who the candidate is. Capturing messages and displaying them on a timeline using weibo’s API is a great way to test candidates.

But pair programming, no matter how good it is, can tell you everything about a candidate. Interviews can help a lot at this point — but don’t waste time asking syntax or language quirks — ask high-end questions, big brother. Ask architecture, programming paradigms. The big desicions can make a big difference in a project’s success or failure.

Anyone who googles grammar and language features can do it all. The software engineering experience you’ve accumulated on the job, as well as the programming paradigms and idioms you’ve learned, are invaluable assets that are hard to Google.

JavaScript is unique in that it plays a crucial role in large projects of all kinds. So what makes JavaScript so special?

Here are a few questions that may help you find out.

Can you name two programming paradigms that are important to JavaScript engineers?

JavaScript is a multi-paradigm programming language that supports both imperative/procedural programming and OOP, Object-oriented Programming), and functional Programming is supported. Object-oriented programming supported by JavaScript includes prototypal inheritance.

Interview bonus

  • Stereotype inheritance (i.e., stereotype, OLOO — objects linked to other objects);
  • Functional programming (i.e. closures, first class functions, lambda functions: arrow functions).

Interview subtractions

  • I don’t even know about paradigms, let alone prototypal OO or functional programming.

2. What is functional programming?

Functional programming is a programming language that combines mathematical functions and avoids shared state and mutable data. Lisp, invented in 1958, was one of the first languages to support functional programming, and lambda calculus arguably gave birth to it. Even today, the Lisp family of programming languages is widely used.

Functional programming is a very important concept in the JavaScript language (it is one of the two pillars of JavaScript). The ES5 specification adds many of the usual functional tools.

Interview bonus

  • Pure functions/function purity
  • Know how to avoid side-effects
  • Combination of simple functions
  • Functional programming languages: Lisp, ML, Haskell, Erlang, Clojure, Elm, F#, OCaml, etc
  • I mentioned the features of the JavaScript language that support functional programming (FP) : a class of functions, higher order functions, functions as arguments/values

Interview subtractions

  • No mention of pure functions, and how to avoid side effects
  • No examples of functional programming languages are provided
  • It doesn’t say what features of JavaScript make functional programming possible

3. What is the difference between class inheritance and stereotype inheritance?

Class Inheritance: Instances are inherited from classes (the relationship between classes and instances can be likened to the relationship between architectural drawings and actual buildings 🏠). At the same time, a superclass-subclass relationship is created, also known as hierarchical Class taxonomies. The new keyword is typically used to call the class’s constructor functions to create instances. However, in ES6, you can inherit a class without the class keyword.

Prototypal Inheritance: Instances/objects are directly inherited from other objects, often by factory functions or object.create (). Instances can be composed from multiple different objects so that they can be inherited selectively.

In JavaScript, stereotype inheritance is simpler and more flexible than class inheritance.

Interview bonus

  • Classes: Create tight coupling, or hierarchies.
  • Prototype: Concatenative inheritance, prototype delegation, functional inheritance and object composition are mentioned.

Interview subtractions

  • It’s hard to know which is better, stereotype inheritance or composition, than class inheritance.

4. What are the advantages and disadvantages of functional programming and object-oriented programming?

Advantages of object-oriented programming: Some basic concepts about “objects” are easy to understand and the meaning of method calls is easy to explain. Object-oriented programming usually uses an imperative coding style, with less declarative style. The code reads like a straightforward set of instructions that the computer can easily follow.

Disadvantages of object-oriented programming: Object-oriented programming often requires shared state. Objects and their behaviors are often added to the same entity, so if A bunch of functions access the entity in an uncertain order, things can go wrong, such as race conditions (function A depends on some property of the entity, However, the property has been modified by function B before A accesses the property, so function A may not get the expected result when it uses the property.

Advantages of functional programming: When you program with a functional paradigm, you don’t have to worry about shared state or side effects. This avoids bugs that can occur when several functions call the same set of resources. With features such as the “point-free style” (also known as implicit programming), functional programming is much simpler and can be used to combine code into more reusable code in a way that object-oriented programming cannot.

Functional programming favors declarative, symbolic style code, which is nota bunch of instructions that need to be executed step by step in order to accomplish something, but rather focuses on what needs to be done at a macro level. What you should do is hidden inside the function. This allows you to refactor your code and optimize performance. To cook a dish, for example, there are three steps: buy the dish, wash it, and stir it. Each step is a function of functional programming, and the process remains the same no matter what dish is cooked. To optimize the process, you have to go into every step of the way. This way, no matter how much internal refactoring or optimization is done, the overall flow remains the same, which is the benefit of functional programming. You can even replace one algorithm with another that is more efficient, with little code change (for example, replacing an early evaluation policy with a lazy evaluation policy).

Computations using pure functions can be easily extended to multi-processor environments or applied to distributed computing clusters without worrying about thread resource conflicts and race conditions.

Weaknesses of functional programming: Code that makes excessive use of functional programming features (e.g., no-parameter style, a large number of method combinations) can compromise readability, resulting in more brevity and less legibility.

Most engineers are still more familiar with object-oriented programming, imperative programming, and for those new to functional programming, even a few simple terms in this field can make them suspicious.

Functional programming has a steeper learning curve because object-oriented programming is so popular and there are so many resources to learn. Functional programming, by contrast, is more widely used in the academic world, less so in industry, and naturally less approachable. When discussing functional programming, people often use the lambda calculus, algebra, category and other disciplines of professional terms and professional symbols to describe related concepts, so others want to start functional programming, they must first understand the basic knowledge of these fields, can not let the head big?

Interview bonus

  • Disadvantages of shared state, competition for resources, etc. (Object-oriented programming)
  • Functional programming can greatly simplify application development
  • Differences in learning curves between object-oriented and functional programming
  • The shortcomings of the two programming methods, as well as the impact on the later maintenance of the code
  • Functional style code base, the learning curve can be steep
  • Object-oriented programming style code base that is difficult to modify and prone to problems (compared to functional style code of comparable level)
  • Immutability greatly improves the visibility and extensibility of program state history, and as such, It’s much easier to add features like infinite undo/redo, rewind/playback, retractable debugging, and so on. Immutability can be achieved in both oo and functional programming paradigms, but the number of shared state objects increases dramatically and the code becomes much more complex when implemented in OO.

Interview subtractions

  • There are no downsides to both paradigms – if you are familiar with at least one of them, you should be able to name many.

5. When should class inheritance be used?

Don’t use class inheritance! Or try not to use it. If you must use it, just use one level of class inheritance, which is almost anti-pattern. This topic (not sure what it’s about…) I’ve been involved in this discussion for years, and the few answers I get end up as common misconceptions. More often than not, the topic gets discussed and then dies down.

If a feature is sometimes useful


But sometimes it can be dangerous


And there’s another, even better, feature you can use


the
Be sure to use another, better feature


~ Douglas Crockford

Interview bonus

  • Try not to use class inheritance at all.
  • Sometimes it is OK to inherit only one level, such as from a framework’s base class, for exampleReact.Component.
  • Object composition is better than class inheritance.

6. When should you use stereotype Inheritance?

Prototype inheritance can be divided into the following categories:

  • Delegation (delegation, prototype chain)
  • Concatenative, such as mixins,Object.assign())
  • Functional (Functional, this functional prototype inheritance is not functional programming. The function here is used to create a closure for private State or encapsulation.

Each of these three types of archetypal inheritance has its own scenarios, but they are all useful because you can achieve composition, That is, A relationship is established that A owns feature B (has-A), A uses feature B (uses-a) or A can implement feature B (can-do). In contrast, class inheritance establishes the relationship that A is B.

Interview bonus

  • Know when modularity or functional programming is not appropriate.
  • Know what to do when you need to combine objects from multiple sources.
  • Know when to use inheritance.

Interview subtractions

  • I don’t know when to use a prototype.
  • I don’t know how to mixObject.assign().

7. Why “object composition is better than class inheritance”?

The quote is from a book called Design Patterns. This means that code reuse should be achieved by combining small units of functionality into objects that meet requirements, rather than by creating layers of objects through class inheritance.

In other words, try to program can-do, HAS-A, or uses-A relationships rather than IS-A relationships.

Interview bonus

  • Avoid class inheritance.
  • Avoid problematic base classes.
  • Avoid tight coupling.
  • Avoid extremely inflexible hierarchies (is-A relationships created by class inheritance can lead to a lot of misuse)
  • Avoid the gorilla banana problem (” You just want a banana and you end up with a gorilla with a banana and the jungle “).
  • Make your code more extensible.

Interview subtractions

  • None of the above is mentioned.
  • It is not clear how object composition differs from class inheritance, nor does it mention the advantages of object composition.

8. Meaning and difference of bidirectional data binding/one-way data flow

Two-way data binding means that the content presented by the UI layer is dynamically bound to the data in the Model layer, so that changes in one layer are immediately reflected on the other. For example, when a user enters a value in the form control of the front page, the Model layer will immediately update the variable of the corresponding control to the value entered by the user. Vice versa, if the data in the Modal layer changes, the changed data will be immediately reflected to the UI layer.

One-way data flow means that only the Model layer is the single source of truth. Changes in the UI layer trigger the corresponding messaging mechanism to inform the Model layer user of the purpose (as opposed to the React Store). Only the Model layer has permission to change the state of the application, so the data always flows in one direction, making it easier to see how the state of the application is changing.

For applications that use one-way data flow, state changes are easy to track, whereas for applications that use two-way data binding, state changes are difficult to track and understand.

Interview bonus

  • React is a classic example of one-way data flow, so mentioning this framework in an interview is a plus. Cycle.js is another popular library for one-way data flow.
  • Angular is typical of two-way data binding.

Interview subtractions

  • Do not understand the meaning of one-way data flow/two-way data binding and cannot tell the difference between the two.

Insight into the

  • Introduction to React.js

9. What are the advantages and disadvantages of individual and microservice architectures?

In the monolithic architecture application, the code of each component exists as a monolithic whole. The components cooperate with each other and share memory and resources.

Microservice architecture, on the other hand, consists of many independent small applications, each of which has its own memory space and is expanded independently of other applications.

Advantages of singleunit architecture: Most applications have a number of cross-cutting concerns, such as logging, traffic restriction, and security requirements such as audit trail and DOS protection, where singleunit architecture has advantages.

When all functionality is running in one application, it is easy to associate components with crosscutting concerns.

The singleton architecture also has performance advantages, as accessing shared memory is still faster than inter-process communication (IPC).

Disadvantages of a single architecture: With the continuous development of application functions of a single architecture, the degree of coupling between services increases. As a result, it is difficult to separate services from each other, making it more inconvenient to perform independent expansion or code maintenance.

Advantages of microservices: Microservice architectures are generally better organized because each service has its own specific role and does not interfere with other components. Once services are decoupled, it is easier to recombine and configure them to serve different applications (for example, serving both Web clients and public apis).

Microservices also have a performance advantage when deployed with the right architecture, because you can easily isolate and scale popular services without affecting the rest of the application.

Disadvantages of microservices: When actually building a new microservices architecture, there are many cross-cutting concerns that were not anticipated during the design phase. If it’s a single architecture application, it’s easy to create shared magic helpers middleware. To solve a problem like this. There’s no trouble.

This is not the case in microservices architecture, which can be solved by either introducing a separate module for each crosscutting concern, or encapsulating the solution for all crosscutting concerns into a service layer through which all traffic flows.

To address crosscutting concerns, monolithic architectures also tend to route all routing traffic through an external service layer, but in this architecture, the transformation can wait until the project is very mature to pay off the technical debt as long as possible.

Microservices are typically deployed on virtual machines or containers, and the number of VM wrangling work cases increases rapidly as the app grows in size. Tasks are automatically assigned using the Container Fleet management tool.

Interview bonus

  • Positive attitude towards microservices, although the initial cost may be higher than that of a monolithic architecture. Knowing the performance and scaling of microservices will perform better in the long run.
  • Have practical experience in both microservice architecture and monolithic architecture applications. You can make the services in your application independent of each other at the code level, but you can quickly package the services into a single architecture application at the beginning of development. The transformation of microservices can be carried out after the application is quite mature and the transformation cost is within the affordable range.

Interview subtractions

  • Do not know the difference between a singleton architecture and a microservice architecture.
  • Do not know the additional overhead of microservices architecture, or have no practical experience.
  • Unaware of the additional performance overhead associated with IPC and network communication in microservices architectures.
  • Downplay microservices too much. It is not clear when to decouple monolithic architecture applications into microservices.
  • Underestimated the advantages of independently scalable microservices.

10. What is asynchronous programming? And why is it so important in JavaScript?

In synchronous programming, the code is executed sequentially from top to bottom (except for conditional statements and function calls), and gets stuck in such places when it comes to network requests or time-consuming tasks such as disk read/write (I/O).

In asynchronous programming, JS runs in an event loop. When a blocking operation needs to be performed, the main thread makes a (asynchronous) request, and the main thread continues to execute the following code. The response is triggered, the interrupt is triggered, the event handler is executed, and the main thread continues on after execution. Thus, a single program thread can handle a large number of concurrent operations.

The user interface (UI) is asynchronous by nature and spends most of its time waiting for user input to break the event loop and trigger the event handler.

Node.js is asynchronous by default, and is built with a server-side execution mechanism similar to that of the user interface, waiting for network requests in an event loop and then processing them one by one.

Asynchrony is important in JavaScript because it is both good for writing UIs and good performance on the server side.

Interview bonus

  • Understand what blocking means and its impact on performance.
  • Understand the event handler and why it is important to the UI part of your code.

Interview subtractions

  • Not familiar with the concepts of synchronization and asynchrony.
  • Can’t explain the performance impact of asynchronous code and UI code, or the relationship between the two.

conclusion

Ask for higher-level knowledge. If you can explain these concepts, you’ll be able to understand language details and syntax in a matter of weeks, even if you don’t have much experience with JavaScript.

Don’t pass on a candidate because he or she doesn’t perform well in simple subjects, such as a classic CS-101 algorithm class or a puzzle class.

What the interviewer should really focus on is whether the candidate knows how to put a bunch of features together to make a complete application.

Recommendation: you can pay attention to me, private message sent ‘architecture’ can get the following information, which has source analysis, performance optimization, micro-service architecture, engineering, distributed knowledge points. The figure below is a part of the information useful knowledge points can be seen at a glance: