Your Privacy

This site uses cookies to enhance your browsing experience and deliver personalized content. By continuing to use this site, you consent to our use of cookies.
COOKIE POLICY

The Road to Angular 2

The Road to Angular 2
Back to insights

In 1955 IBM developed the first high level programming language, FORTRAN.  Instead of using assembly code, FORTRAN gave your punch cards the ability to use 32 statements that would be compiled down into mainframe programs.  This abstraction drastically reduced the amount of code a program required and increased developer output (and presumably, their sanity). But why am I talking about an old language from the 50s?  It seems so far removed for the popular languages that we use today.  However, for the last 60 years, FORTRAN has been consistently updated.  The language is like a time capsule for the programming paradigms of the day.  Updates were made for Modular Programming, Structured Programming, Recursion, Object Oriented Programming, and more.  Be on the lookout for FORTRAN 2015 which releases in 2018.

The amount of languages and frameworks that exist today are staggering.  To stand above the rest, one must adapt to keep up with all the new proven methodologies.  Software updates are a fact of life now and dependency management is a part of every build. A new version can be as easy as changing a number and some minor refactoring.  But what if a new update requires drastic rewrites of a codebase?  Angular 2.0 was just released on September 14th and is still in its infancy.  How do you transition? And, is it really worth it?

This type of upgrade cannot happen overnight.   This change costs development time, defers new features, and causes a divide in the development community between the old and the new. When Python 3 came out in 2008, it standardized some of the languages features and brought Unicode support.  However, without specialized libraries, Python 2 code was no longer compatible with new Python 3 code.  As an import heavy language, there was large incentive to continue to use Python 2 until a majority of Python libraries were ported to Python 3.  It wasn’t until this year that Ubuntu finally started including Python 3 in its distribution, 8 years after Python 3’s initial release.

Right now the web framework AngularJS is going through a similar transformation.  In 2014 they announced that AngularJS will be rewritten for the modern browsing experience.  Inspired by concepts from competing technologies like React, Angular 2 promises to be modular, fast, and easy to maintain.  This sounds great, but these new features do not just plug into existing Angular code.  Angular 2 recommends using TypeScript instead of JavaScript.  Templates are now made up of a tree of specialized components that handle defined inputs and outputs.  The almighty “$scope” is gone for good.  In a large application written by many developers, refactoring for Angular 2 seems impossible.

Fortunately, I think the Angular developers learned from the past, and want to avoid having a large disconnect for the next 10 years.  They have released an upgrade guide that provides a clear path for developers going forward.  What I find clever is this path will improve your AngularJS code, even if you decide not to upgrade.  There are two things you can do today that will make your code cleaner with the added benefit of increased Angular 2 readiness: follow the style guide and try using the 1.5.x component directive.  If you haven’t looked at the style guide before, it is a great resource for how to structure Angular code while also giving justifications on why.  As the guide highlights, using the “controllerAs” syntax is a fantastic alternative to using “$scope” and will immediately clarify which variables belongs to which controllers in the DOM.  Using the component directive will prepare you for the new workflow of Angular 2.  It will help you get used to the component lifecycle, avoid two way bindings, and understand the component tree.  These smaller pieces of code are easier to reuse, test and understand.

Once you have mastered the initial steps, and decide to move forward with the upgrade, the path admittedly gets trickier.  Additionally, like the Python 3 problem, you may rely on a bunch of Angular 1 libraries do not transfer easily.  What the framework has done is provide a “Dual Boot” set up where Angular 1 and 2 frameworks run together using the Upgrade Adapter.  This allows developers to avoid having to convert all of their code at the same time.  Used responsibly and with a timeline for conversion, I can see this being a smart choice.  However, I am worried that many applications will be stuck on this step, never fully committing to Angular 2 and dealing with communication issues between the old and the new.  But with good planning, the promise land of a modern web framework can be reached where the productivity gains make it all worthwhile.

Right now Angular 2 is in its infancy.  Developers are still apprehensive about the drastic differences between the versions.  The developers at Angular realize how much they are asking of their users and have provided a good path for transitioning.  While it is too early for many teams to begin upgrading, I recommend these five steps to making sure your app is “Angular 2 Ready:”

  • Use the style guide
  • Follow current best practices in regards to “$scope”
  • Use Components in Angular 1, understanding what benefits they offer
  • Gain an understanding of the Angular 2 syntax and workflows
  • Review the Angular 2 migration process

There is no downside to readying your app.  At worst you made your codebase cleaner and easier to maintain.  There is no doubt that this is a big change, but I look forward to using the new features of Angular 2 as it gains support and popularity in the development community.

Digging In

  • Digital Products

    Unlocking Business Potential: The Power of Custom Application Development

    Like any savvy business leader, you’re likely always on the lookout for tools to give your company a competitive edge. And in doing so, you’ve undoubtedly considered investing in custom application development. But the question is, how do you ensure that such a major investment in a custom web application development provides a strong return on […]

  • Digital Products

    Mastering Legacy Application Modernization: Strategies for Success

    The ironic truth of the business world is that change is the only constant. But this means that failing to keep pace with the competition and its technologies will only end with you falling behind. That’s where legacy application modernization enters the fold. When you modernize legacy applications, your team gains access to new features […]

  • Digital Products

    CTO Confessions Podcast

    In this episode of CTO Confessions, Rob Phillips, the Vice President of Software Engineering at UDig, digs into his journey from a passionate technologist in his youth to a seasoned leader in the tech industry. He shares valuable lessons on transitioning to senior leadership, the importance of understanding and articulating company problems, and the art of empowering teams for high performance.

  • Digital Products

    Navigating the Challenges of On Premise to Cloud Migration

    In today’s rapidly evolving technological landscape, the shift from on premise solutions to cloud-based infrastructure has become a pivotal transformation for organizations seeking to modernize their IT operations. This transition holds the promise of increased agility, cost savings, and enhanced scalability. However, it is not without its set of formidable challenges that organizations must navigate. […]

  • Digital Products

    The Power of Transferrable Skills in Tech Projects

    Every project has its own unique elements that require flexibility to be effective and achieve success. This often requires picking up new pieces of a tech stack, learning a new programming language, or a new project methodology. Fortunately, there are also many transferrable skills that carry over from one project to the next. In my […]

  • Digital Products

    The Four Pillars of Effective Digital Product Development

    In 2020 alone, approximately two billion consumers purchased at least one digital product. From software licenses to mobile apps and tech tools, consumers are becoming increasingly active in the digital product market, a trend that has naturally spurred brands across a wide range of industries to reevaluate their digital product design and development process workflows. […]