Skip to main content

Learning Frontend Development

· 6 min read

Vue.js is a progressive JavaScript framework for building user interfaces. Its core library focuses solely on the view layer, making it easy to integrate with other libraries or existing projects. Vue.js follows the MVVM pattern, keeping the view and the data in sync through two-way data binding, so developers can manage data and views far more conveniently.

Why Learn a Frontend Framework

The reason for these notes is simple: as a mostly backend developer, there's no escaping the fact that sooner or later I'll have to build pages myself. In the traditional jQuery style, data is scattered all over the DOM; changing one piece of state means manually locating the corresponding node and updating it, and once the page gets complex the code turns into unmaintainable spaghetti. Vue.js solves exactly this problem—it hands the synchronization of data and view over to the framework, leaving the developer to care only about the data itself. On top of that, its "progressive" positioning means you don't have to rewrite an entire project: you can try it out in a single page or a single module first, which is very friendly to teams with existing codebases.

Vue.js - The Progressive JavaScript Framework | Vue.js

What Makes Vue.js Stand Out

Key characteristics of Vue.js:

  1. Two-way data binding: Vue.js keeps data and views automatically in sync through two-way data binding, making both much easier to manage. The mechanism behind it is data interception plus publish-subscribe: the framework intercepts reads and writes on data properties, collecting dependencies on read and notifying the corresponding views on write. You mutate a plain JavaScript object, and the page follows along—no more manual DOM manipulation.

  2. Component-based development: Vue.js supports breaking a page into independent components, each with its own data and view, easy to reuse and maintain. Components pass data down through props and notify upward through events, with clear boundaries. This mirrors how backend code is split into modules and classes by responsibility, so it's not hard for backend folks to grasp.

  3. Lightweight and approachable: The Vue.js API is simple and clear, the learning curve is gentle, and it plays well alongside other frameworks and libraries (like React and Angular). The official documentation is available in Chinese with plenty of examples, and you can start writing with a single script tag—no build tooling required, which matters a lot to beginners.

  4. Template-oriented programming: Vue.js separates HTML from JavaScript, keeping the code clean and readable. Templates are essentially still HTML, just with interpolation and directives added—what you write for the page structure is what you get, while the logic stays contained in the component's JavaScript.

Vue.js Under the Hood

Technical details worth knowing:

  1. Virtual DOM: Vue.js uses a Virtual DOM to make DOM operations efficient, improving performance and user experience. The idea is to describe the DOM tree as JavaScript objects in memory first; when data changes, a new virtual tree is generated and diffed against the old one, and only the parts that actually changed are applied to the real DOM. Touching the real DOM directly is expensive—this intermediate layer keeps the "what changed" computation in memory, where it's far cheaper.

  2. Lifecycle: Vue.js components have their own lifecycle—creation, mounting, updating, destruction—and you can hook different logic into each stage. API requests typically go after creation completes; logic that needs the real DOM must wait until mounting is done; and resources like timers and event listeners should be cleaned up in the destruction phase. Understanding the lifecycle is the key to understanding when your code actually runs.

  3. Directives and events: Vue.js provides directives and event handling such as v-if, v-for, and v-on, making it easy to manipulate DOM elements and respond to user actions. v-if controls whether an element renders, v-for handles list iteration, and v-on binds event callbacks. Directives declare common DOM operations right in the template, so reading the template tells you how the page behaves—far more transparent than sprinkling addEventListener calls throughout your JavaScript.

  4. Plugins and component libraries: The Vue.js ecosystem is rich, with a wealth of plugins and component libraries for building high-quality applications quickly. Routing and state management have official solutions, and mature UI component libraries exist too—most admin-style pages can be assembled from parts rather than built wheel by wheel.

What TypeScript Changes

Frontend technology has evolved enormously, and with TypeScript in the mix I personally think the outlook is excellent. JavaScript has always been weakly typed; with TypeScript it gains fixed syntax, data types, and the concept of classes, making frontend logic far clearer. Combined with Vue's componentization, frontend development can now roughly follow an MVC-style structure. You can write components and complex business-logic layers with TypeScript and Vue together—it's genuinely much cleaner than how things used to be written.

For someone used to strongly typed languages, the significance is this: the shape of API data can be described with type definitions, the editor provides completion and checking, and many trivial mistakes surface at compile time instead of as undefined errors in the browser. The larger the frontend project, the more that layer of constraint pays off.

Pitfalls and Caveats

A few reminders from the learning process:

  1. Two-way binding isn't omnipotent. Data interception has its limits—certain operations on objects and arrays go unnoticed by the framework. When you hit "I changed the data but the page didn't update," check the reactivity caveats first rather than assuming the framework is broken.

  2. Don't manipulate the DOM directly inside components. Since you've handed view management to the framework, drive the page through data. Mixing in manual DOM operations fights the framework's update mechanism and produces bugs that are very hard to trace.

  3. Split components in moderation. Split too finely and props drilling through layers becomes painful; don't split and a single component bloats. "Independently reusable, single responsibility" is a good rule of thumb for granularity.

Wrapping Up

Vue.js frees frontend development from manual DOM manipulation through two-way data binding and componentization, while the Virtual DOM and the lifecycle are the two keys to understanding how it runs. For a backend developer, once TypeScript is in the picture, frontend code gains a sense of order—types and layers—and the learning cost turns out lower than expected. These notes capture the conceptual layer; the pitfalls I hit in real projects will get written up separately.

COMMENTS