惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
C
Cisco Blogs
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
S
Security Affairs
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
Simon Willison's Weblog
Simon Willison's Weblog
WordPress大学
WordPress大学
小众软件
小众软件
Security Latest
Security Latest
AWS News Blog
AWS News Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
F
Full Disclosure
S
Schneier on Security
L
LangChain Blog
MyScale Blog
MyScale Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
Google Online Security Blog
Google Online Security Blog
Scott Helme
Scott Helme
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
A
Arctic Wolf
Martin Fowler
Martin Fowler
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
Latest news
Latest news
F
Fortinet All Blogs
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Hacker News: Ask HN
Hacker News: Ask HN

Minko Gechev's blog

skillgrade Unit Tests for AI Agent Skills You Should Care About AI Generative Development LLM-first Web Framework Reactive framework in ~200 lines of JavaScript Managing Angular Are LLMs going to replace us? Prefetching Heuristics Design Patterns in Open Source Projects - Part II Design Patterns in Open Source Projects - Part I What I learned doing 125 public talks - Part I Dynamic imports solve all the problems, right? 5 Angular CLI Features You Didn't Know About Angular quicklink Preloading Strategy Introducing Bazel Schematics for Angular CLI Building TypeScript Projects with Bazel Joining Google Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation Fast, extensible, configurable, and beautiful linter for Go Introducing Guess.js - a toolkit for enabling data-driven user-experiences on the Web Machine Learning-Driven Bundling. The Future of JavaScript Tooling. JavaScript Decorators for Declarative and Readable Code 3 Tricks For Using Redux and Immutable.js with TypeScript Follow Your Dream Career with Open Source. Personal Story. Redux Anti-Patterns - Part 1. State Management. Faster Angular Applications - Understanding Differs. Developing a Custom IterableDiffer Faster Angular Applications - Part 2. Pure Pipes, Pure Functions and Memoization Faster Angular Applications - Part 1. On Push Change Detection and Immutability Understanding Dynamic Scoping and TemplateRef Implementing a Simple Compiler on 25 Lines of JavaScript Developing Statically Typed Programming Language WebVR for a Gamified IDE 7 Angular Tools That You Should Consider Announcing ngrev - Reverse Engineering Tool for Angular Implementing Angular's Dependency Injection in React. Understanding Element Injectors. Distributing an Angular Library - The Brief Guide Angular in Production Ahead-of-Time Compilation in Angular 2.5X Smaller Angular 2 Applications with Google Closure Compiler Using Stripe with Angular (Deprecated) Building an Angular Application for Production Implementing the Missing "resolve" Feature of the Angular 2 Router Scalable Single-Page Application Architecture Managing ambient type definitions and dealing with the "Duplicate identifier" TypeScript error Static Code Analysis of Angular 2 and TypeScript Projects ViewChildren and ContentChildren in Angular Dynamically Configuring the Angular's Router Angular 2 Hot Loader Lazy Loading of Route Components in Angular 2 Aspect-Oriented Programming in JavaScript Flux in Depth. Store and Network Communication. Using JSX with TypeScript Flux in Depth. Overview and Components. Even Faster AngularJS Data Structures Boost the Performance of an AngularJS Application Using Immutable Data - Part 2 Angular2 - First Impressions Build Your own Simplified AngularJS in 200 Lines of JavaScript Persistent State of ReactJS Component Boost the Performance of an AngularJS Application Using Immutable Data Processing Binary Protocols with Client-Side JavaScript Stream your Desktop to HTML5 Video Element Multi-User Video Conference with WebRTC Asynchronous calls with ES6 generators Binary Tree iterator with ES6 generators WebRTC chat with React.js AngularJS in Patterns (Part 3) AngularJS in Patterns (Part 2). Services. Using GitHub Pages with Jekyll! AngularJS in Patterns (Part 1). Overview of AngularJS Singleton in JavaScript Express over HTTPS What I get from the JavaScript MV* frameworks Remote Desktop Client with AngularJS and Yeoman The magic of $resource (or simply a client-side Active Record) AngularJS Inheritance Patterns AngularAOP v0.1.0 Advanced JavaScript at Sofia University AngularJS style guide Lazy prefetching of AngularJS partials VNC client on 200 lines of JavaScript Aspect-Oriented Programming with AngularJS CSS3 flipping effect Practical programming with JavaScript Why I should use publish/subscribe in JavaScript JavaScript, the weird parts Functional programming with JavaScript plainvm Looking for performance? Probably you should NOT use [].sort (V8) JavaScript image scaling ELang Caching CSS with localStorage Self-invoking functions in JavaScript (or Immediately Invoked Function Expressions) Asus N56VZ + Ubuntu 12.04 (en) Asus N56VZ + Ubuntu 12.04 Debian Squeeze + LXDE on Google Nexus S (or having some fun while suffering) HTML5 image editor Курсови проекти – ФМИ Carousel Gallery SofiaJS...
Enforcing Best Practices with Static Code Analysis of Angular 2 Projects
2016-02-18 · via Minko Gechev's blog

About two weeks ago I published the initial draft of a Community-driven Angular 2 Style Guide. It was based on:

  • Patterns I noticed in the Angular 2 source code while contributing to the framework.
  • Suggestions by Miško Hevery during his technical review of my book “Switching to Angular 2”.
  • My own development experience with Angular 2.
  • AngularJS 1.x common practices which could be applied to Angular 2 applications keeping the transition process smoother.

At the time of the first push of the document I got a quick feedback by the manager of Angular Brad Green:

@mgechev Love the start and the great explanations. And a smashing logo to boot! :) pic.twitter.com/7dPVQPvhQa

— Brad Green (@bradlygreen) February 3, 2016

As you might guess the initial draft was a bit misshaped and based only on my personal perspective. Although the great ideas I got from Miško Hevery, everything went through my own prism. That was the main idea to publish it on this early stage of the Angular’s life-cycle - to gather feedback from other great, experienced developers.

We had great discussions on the directory structure that we all agreed upon. We achieved balance between suggestions by @e-oz for by-type division, @evanplaice, @nareshbhatia, @d3viant0ne and all other great ideas proposed during the discussion. Of course, that is only a small fraction of all the brainstorming. You can take a look at the issues of the project for more.

What are the biggest benefits I found working in such an open environment?

Diverse Experience

The best practices went through the perspective of different developers with diverse experience. Showing everyone’s point of views and agreeing upon common, generic practices that can work for most of us is priceless.

Another great benefit is that one extra pair of eyes can find and help fixing mistakes and deliver everything into a more consistent way.

Rediscovering Best Practices

We rediscovered already existing best practices and patterns from the software engineering such as:

  • Bounded context a concept from the Domain-Driven Development that helps us divide our code units in the most balanced way.
  • Façade pattern a design pattern, initially introduced by the Gang of Four which fits perfectly in providing a high-level interface for a larger body of code.

Facing same problems solved decades ago and using the same terms helps us communicate easier. In the end, that is one of the core purposes of the design patterns - to ease the communication across developers.

Learning new Things

Definitely, it is worth mentioning that everyone expressing his thoughts and opinion on given topic can extend our knowledge.

I believe these are only a few of the benefits from the open source ideology.

Going a bit further!

Building a complete set of best practices which puts most of the Angular 2 projects under a common shape is quite important. There is no point explaining why it is worth following a common guidelines that are pointing the correct path.

But what is the process we use to enforce these practices? Code review. This means that one human being writes code, trying to follow all the practices listed in a huge document and another human being needs to verify that these practices are followed properly.

There’s one sure thing - this is quite an error-prone mission!

During the last a couple of days I’m working on a static code analyzer which makes sure we’re following the best practices. Since its main goal is to be configurable, I’m planning to make it compatible with the community-driven style guide we are working on, as well as the John Papa’s style guide which should be released in the next a couple of months.

I called the project ng2lint and at this moment it is based on tslint.

How does ng2lint work?

What ng2lint does is to take the abstract-syntax tree (AST) generated by the TypeScript compiler based on the source code of our application and analyze it. If you have further interest on the topic I strongly recommend you to take a look at “Modern Compiler Design 2nd ed.”.

Future plans…

TypeScript builds a great intermediate representation of the code we write, which is perfect for analysis. However, such an intermediate representation for an Angular 2 project could be considered as a superset of what TypeScript provides us. For instance, in Angular 2 each component has a template. In order to verify that all used inside this template directives are declared in the directives property of the target component or any other parent component, we need to parse the template as well.

And what about file naming conventions? Well, we’ll need to verify all the naming is following common conventions as well!

Given all this a more sophisticated tool will be required. Since I’m working on this linter in my spare time I cannot guarantee full style guide coverage in the next a couple of months but you can follow my progress here.