r/webdev • • Oct 18 '18

Angular 7.0.0 released

/r/Angular2/comments/9pbn4f/angular_700_released/
223 Upvotes

148 comments sorted by

View all comments

Show parent comments

15

u/E2Ehh Oct 19 '18

Not an Angular engineer here, just a dev who uses Angular for their day job.

I think a lot of people who are fans of other frameworks like to jump in and make a deal out of Angular releases as a way to "1 up" for their framework of choice. I tend to downvote comments that don't contribute to the discussion, e.g. people who don't understand semver and just want to take a jab.

You are absolutely correct that stability is a major factor for a framework, and there needs to be a balance between innovation and stability. The Angular team seems to have set that threshold at 1 year. Major versions are released about every 6 months, and breaking changes have a whole extra major version before coming into effect (e.g. an API will be deprecated in v4, and removed in v5). Source: https://angular.io/guide/releases

That's pretty reasonable to me and my team, and if you use the framework as it's intended and practice good software architecture in general, the upgrades are usually pretty painless.

For example, when Http was deprecated in favour of HttpClient, it was literally 1 place in the code to go update, because we have a layer of abstraction between our components and the API. If we had build the app in such a way that each component was firing off API calls willy-nilly, it would have been a real pain. So sometimes when you see people saying upgrades were very hard, it's because they are working on a codebase that has not been built in a maintainable fashion. I would imagine they suffer from similar issues when upgrading other libraries or performing other routine maintenance.

As to your point of companies not picking frameworks based on churn, I think it entirely depends on the type of software being written. If I worked for an agency, and was churning out hundreds of sites a year for different clients, and needed to keep them all patched / updated but was not actively developing on them once released, I might not pick Angular. However I work on a single product (split into a handful of Angular applications), and we've been going since Angular 2 beta days and are still iterating on it with no end in sight. For this kind of product development, some minor framework changes once every 6 months / year is not a big deal, we're constantly doing this kind of maintenance as all of our dependencies update anyway.

So perhaps some of the condescension / downvotes being thrown around are by different groups of developers who don't entirely understand what the other groups are doing day to day. React vs Angular vs Vue vs WhateverJS is a bit of a silly debate IMO, they are all good at different things and people should pick the best tool for the job at hand and be happy for everyone else working on the web platform as a whole - we're all on the same team here!

4

u/gabynevada Oct 19 '18

Any insights on how to perform the HttpClient abstraction? Do you mean performing an abstraction between the HttpClientModule and the services?

5

u/ggeoff Oct 19 '18 edited Oct 19 '18

It's probably something as simple as

class RestService {

    constructor(private http: HttpClient) {}

    get<T>(path: string) : Observable<T> {
        return this.http.get<T>(path);
    }
    ...

}

class UserService { 
    constructor(private restService: RestService) {} 
    
    getUser(id: number): Observable<User> {
        const path = `path/to/user/${id}`
        return this.restService.get<User>(path);
    } 
}

Sorry for formatting on my phone Now you only inject the http client into the rest service so any changes that may happen to the httpclient in angular is isolated to our rest service. edit. fixed formatting

2

u/E2Ehh Oct 19 '18

Yep, this is essentially what we do ^