Author: Vyacheslav Gorlov

  • Is TypeScript the New JavaScript?

    Is TypeScript the New JavaScript?

    While JavaScript is frequently the language of choice for all sizes of frontend and backend applications, it’s not the only option; nor is it necessarily the most efficient or cost-effective. Increasingly, TypeScript is becoming the go-to language for app development—particularly for larger apps. The time- and cost-saving benefits are significant enough that some organizations are even taking projects initially started in JavaScript and migrating them to TypeScript. 

    What is TypeScript?

    While the number of programs written in JavaScript has grown exponentially, the programming language’s ability to express the relationships between different units of code and mitigate coding errors early on hasn’t kept pace. Along with JavaScript’s inconsistent semantics, this makes JavaScript-driven app development difficult to manage at scale.

    Released in 2012, TypeScript was created to address JavaScript’s deficiencies in developing large-scale apps. It’s an open source, strongly typed programming language that builds on JavaScript by adding optional static typing. Types enable structuring and validating code before it’s executed, which is beneficial when developing large apps. They also provide additional information about code, which serves as better documentation for other developers and facilitates collaboration.

    TypeScript is a superset of JavaScript, which means any JS code is also valid TS code—provided the TS configuration is set to be compatible with it. It outputs code in pure JavaScript and allows developers to liberally use JS libraries, tools and frameworks. It runs on Node.js or any browser that supports ECMAScript 3 or higher. It also supports object-oriented programming features. 

    JavaScript Drawbacks

    JavaScript is one of the world’s most popular programming languages and works extremely well for small projects. However, its disadvantages—many of which affect project costs and code delivery time—make a strong case for considering alternatives such as TypeScript, particularly for larger projects.

    Most of these drawbacks have to do with the lack of types and compile-time error checks, making JavaScript less than desirable for server-side code in enterprises and large codebases. The following are just a few of its disadvantages:

    • JavaScript employs dynamic typing, which means scripts can compile even if they contain errors that can prevent them from properly running.
    • Because JavaScript is dynamically typed, it allows one variable to have multiple properties assigned to it. It doesn’t instantly let developers know what a variable can contain. That makes it easy to assign the wrong properties.
    • Since JavaScript is an interpreted language, errors can only be found during runtime. Code needs to run before being tested and validated, so it can take considerable time to find bugs and errors in JavaScript code.
    • To eliminate inaccuracies, it’s necessary to manually verify types and the syntactic correctness of the code. This lengthens development time and extends the delivery cycle to production, increasing development costs.
    • JavaScript code is executed on the client side so it’s viewable to the user. As a result, bugs and oversights have the potential to be exploited for malicious purposes. 
    • Lengthy onboarding of new developers can result because developers must figure out the properties of the structures they’re working with, as well as the data types. While JSDoc can be used for documenting code and annotating types, there’s still the need to synchronize the actual code and documentation. The lack of synchronization, in turn, can mislead developers and complicate the introduction of new, business-requested features.
    • JavaScript is prototype-based, not class-based. It’s not considered a pure object-oriented programming language, although it can follow some object-oriented programming principles.

    The TypeScript Advantage

    TypeScript is a superset of JavaScript. If a developer knows JavaScript, there’s not much of a learning curve to take advantage of the features TypeScript offers that make up for many of JavaScript’s deficiencies—and it can offer additional benefits.

    For example, with JavaScript, variables can start as one property, and then change into an object or a string. These inconsistencies can generate problems that are difficult to resolve in large apps. TypeScript, on the other hand, analyzes the code and tries to determine proper variable types prior to runtime. Once a variable type is assigned, it stays unchanged. TypeScript’s compiler also helps shorten the QA and testing process in later stages of development.

    TypeScript also helps developers quickly figure out the purpose of a variable within the code. It can also suggest available properties in functions, classes or components. Being able to quickly look up a variable is important because it reduces the likelihood of calling the wrong function or accidentally skipping a variable declaration. Any reduction in bugs and errors reduces the time required for fixing those issues and, therefore, reduces overall development time. That gives developers more time to work on app logic and fix errors that can be detrimental to in-app performance and usability. According to a postmortem analysis by Airbnb, 38% of bugs they encountered were preventable with TypeScript after the company adopted it throughout the organization. 

    As a static language, TypeScript performs type checks upon compilation, flagging type errors and helping developers spot mistakes early on in development. Reducing errors when working with large codebases can save hours of development time.

    Clear and readable code is easy to maintain, even for newly onboarded developers. Because TypeScript calls for assigning types, the code instantly becomes easier to work with and understand. In essence, TypeScript code is self-documenting, allowing distributed teams to work much more efficiently. Teams (and individual developers) don’t have to spend inordinate amounts of time familiarizing themselves with a project.

    TypeScript’s integration with editors also makes it much easier to validate the code thanks to context-aware suggestions. TypeScript can determine what methods and properties can be assigned to specific objects, and these suggestions tend to increase developer productivity.

    TypeScript is widely used to automate the deployment of infrastructure and CI/CD pipelines for backend and web applications. Moreover, the client part (for example, when using Angular) and the backend can be written in the same language—TypeScript. This flexibility allows an engineer who knows one programming language to cover all parts of the system.

    Because TypeScript essentially transpiles to JavaScript, migrating existing code to TypeScript is easy and fast. It can typically be accomplished simply by running the compiler and adding typing where it’s not recognized by the language. There’s no need to make changes to the code.

    The benefits of TypeScript have been noticed by developers. TypeScript was used by 78% of the 2020 State of JS respondents, with 93% saying they would use it again. TypeScript continues to grow in popularity. It was voted the second most-loved programming language in the Stack Overflow 2020 Developer survey. 

    TypeScript & AWS: Better Together 

    There’s another compelling reason to consider TypeScript for large-scale app development projects. It’s fully supported by AWS, the leading cloud platform for modern app design and development as noted in Gartner’s Magic Quadrant for Cloud Infrastructure and Platform Services.

    The following services and tools have seamless integration out-of-the-box with TypeScript, enabling you to use this language for a vast number of tasks:

    • AWS CDK provides infrastructure-as-code (IaC) to automatically deploy the entire infrastructure in one click. You can also automate the creation of CI/CD pipelines for the future launch of specific jobs on demand.
    • AWS Lambda allows you to run computation tasks in serverless mode using automatic scaling and an efficient pricing scheme.
    • Amazon EC2, ECS and EKS can cover any of your tasks and provide a wide range of solutions for running apps written in TypeScript—from bare metal servers to complex clusters of hundreds of Docker containers.

    Optimize Your Application Development Projects

    All decisions made during an application development project can impact overall costs and time to market. That includes going with the right programming language and using the most appropriate cloud platform and resources. 

    When approaching an app dev project, a one-size-fits-all approach rarely works. Take the time to define your needs and priorities and select the best resources to deliver the best results.

  • 5 Best Machine Learning Use Cases

    5 Best Machine Learning Use Cases

    Many industries are struggling with the ongoing COVID-19 pandemic, and the IT industry itself and the broader trend of transition to remote work over the last year revealed many areas where traditional approaches to managing businesses created unnecessary waste. Data science and its counterpart, machine learning, revealed that expansion in the ways technology can facilitate new ways of working is nearly limitless.

    Machine learning uses powerful algorithms to discover insights based on real-world data. These insights can then be used to make predictions about future outcomes. As new data becomes available, machine learning-enabled programs can automatically adapt and produce updated predictions. As with any tool, machine learning is not a silver bullet. However, there are many situations in which the technology can outperform linear and statistical algorithms.

    Here are five of the most common use cases where machine learning can make a big difference:

    When engineers can’t code rules for certain problems. Many human-oriented tasks (such as recognizing whether an email is spam) aren’t solvable using simple (deterministic), rule-based solutions. Because so many factors may influence an answer, engineers would have to write and frequently update billions of lines of code. In addition, when rules depend multiple factors and when those rules overlap or need fine-tuning, it becomes difficult for humans to code precise rules. Fortunately, machine learning programs don’t require users to encode actual patterns. These programs only need proper algorithms to extract patterns automatically.

    When you need to scale a solution to millions of cases. In finance, for example, you might be able to manually categorize a few hundred payments as either fraudulent or not. However, this becomes tedious or impossible when dealing with millions of transactions. As user bases grow, it’s no longer feasible for organizations to process payments by hand – end-users today want answers about their money in milliseconds, not minutes or hours. Machine learning solutions are effective at handling these types of large-scale problems with little to no human intervention.

    When you can do it manually, but it’s not cost-efficient. There are situations in which in-house experts could process many requests quickly and accurately, but at a high cost. For instance, imagine you assess DMV forms for in-state and out-of-state car purchases to determine their validity before passing them on. In this situation, the business processes are well-defined, optimized and serialized. It may take only a few minutes to check each form thoroughly. But allocating so much manual labor to this work is likely not the best use of your budget. Machine learning, on the other hand, offers predictable, pay-as-you-go pricing for fully scaled operations.

    When you have a massive dataset without obvious patterns. Consider this – you’ve successfully prepared a well-curated dataset and know the underlying problem you’re trying to solve. However, you don’t see any explicit patterns in the data, preventing you from encoding those validations. Plus, there are many typos, missing fields, and other human-caused errors with no validation in place. You may even know the data is poor quality and can manually determine every affected row. But you can’t see any actual connections between valid and invalid records. Machine learning algorithms can solve this problem. They can find hidden connections between data points that aren’t clear to humans. Tools like interpreting tracers can even describe how machine learning models arrived at their conclusion(s).

    When you live in an ever-changing universe (adaptive). The world, and its problems, are always changing. A problem you solved yesterday can, today, easily mutate into something else entirely, rendering your previous solution inefficient or even useless. For example, if your organization processed medical appointment records to extract diagnoses, procedure information and billing codes, your rules might have to evolve constantly. However, you can’t make updates in real-time, 24/7. Meanwhile, incorrectly labeled items could lead to insurance rejections, huge fines and legal penalties. One major advantage of machine learning methods is that they can learn from data across the entire life cycle of your application – from the first line of code written to the moment when the model is finally shut down. Moreover, it’s important for production-grade systems to have feedback loops so that you can catch the moment when your model no longer solves problems correctly.

    It’s important to remember that machine learning is a tool – it’s not magic. Machine learning models are, essentially, advanced math-based algorithms, which identify patterns in data and learn from them. However, when properly applied to the right use cases, machine learning can reduce the amount of time spent on error-prone manual IT operations, adding significant business value and greatly reducing IT costs.

  • New AWS Services Optimize App Development Process

    New AWS Services Optimize App Development Process

    Amazon Web Services (AWS) is always busy introducing new services, enhancing existing ones and, quite often, driving trends. However, the cloud services provider has upped its game even more in recent months.

    In the first half of 2020, AWS announced an astonishing number of developments that enable technology interoperability, simplifying legacy feature removal, creating greater flexibility and time-savings for developers and putting new capabilities at users’ fingertips.

    AWS and ARM Power

    You are going to be hearing a lot about ARM processor architecture and not just because the chipmaker is being acquired by Nvidia, the leading maker of GPUs.

    Developed in the 1980s, ARM processors are finally hitting their stride as companies are embracing ARM-based chips. ARM-based processors combine high-performance RISC designs, lower manufacturing costs and reduced power consumption, making them ideal for portable devices such as smartphones, tablets and even laptops. More and more companies are designing processors that implement ARM architecture, including Apple, AppliedMicro, Broadcom, Qualcomm and Samsung Electronics. This year, Apple brought ARM chips into the desktop world with tailored extensions such as a built-in security enclave, a motion co-processor and a neural engine.

    AWS is among those embracing ARM architecture, which has led to introducing an array of robust services that will benefit developers and end users alike. Case in point: This summer, AWS announced the general availability of its sixth generation of Amazon Elastic Compute Cloud (Amazon EC2) instances, including general-purpose (M6g), compute-optimized (C6g) and memory-optimized (R6g) instances. Powered by AWS-designed, ARM-based Graviton2 processors, they deliver up to 40% better price/performance over comparable current-generation x86-based instances.

    They also offer 50% more NVMe SSD storage GB/vCPU over comparable x86-based instances. The local SSD storage works well for apps that require high-speed, low latency storage, as well as for temporary storage of data such as batch and log processing, and high-speed caches and scratch files.

    They’re ideal for workloads ranging from application servers, microservices and high-performance computing to CPU-based machine learning inference, electronic design automation and gaming. Numerous organizations have already successfully adopted ARM-powered instances and are realizing price/performance benefits.

    The AWS Graviton-based instances are supported by a broad ecosystem of operating systems and services from independent software vendors (ISVs) as well as AWS. They can be purchased as on-demand, reserved, or spot instances; covered by savings plans or as dedicated hosts/instances, and support up to 19 Gbps Elastic Block Store (EBS) bandwidth.

    The AWS Graviton2 processor itself, released in late 2019, deserves recognition, too. Compared to first-generation ARM-powered Graviton processors, they provide twice as fast floating-point performance per core for scientific and high-performance computing workloads. They also offer optimized instructions for faster machine learning inference, always-on fully encrypted DDR4 memory and 50% faster per core encryption performance to further enhance security.

    A number of AWS services, such as Amazon Elastic Load Balancing, Amazon ElastiCache and Amazon Elastic Map Reduce, have realized superior price/performance in testing and will be moving into production on Graviton2-based instances.

    Better, Easier Artifact Management

    AWS isn’t the only organization opting for ARM. As many others prepare to make a move, AWS is doing its part to facilitate the transition. That includes deploying services that streamline various aspects of the app development process, in keeping with the efficiencies and increased performance offered by ARM-based chips.

    One that we’re most excited about is AWS CodeArtifact. This fully managed software artifact repository service eliminates the need for setting up, operating and scaling the infrastructure required for artifact management. It works with commonly used package managers and tools such as Maven and Gradle (Java), npm/yarn (JavaScript) and pip/twine (Python), so it can easily be integrated into existing development workflows.

    AWS CodeArtifact can be used for creating centralized repositories for sharing software packages approved for use across development teams. Its integration with AWS Identity and Access Management (IAM) enables access control. Its support for AWS CloudTrail provides visibility into which packages are in use and where they can easily be updated or removed.

    AWS Making Containerization Easier

    Using containers to modernize existing apps make them portable, increases development agility and reduces operational costs. The problem is that the process requires numerous manual tasks that are time-consuming and error-prone, and slow down modernization efforts.

    That’s why we think another recently deployed AWS service will have a positive impact on the app development process. AWS App2Container is a command-line tool that helps containerize existing apps running on-premises, in Amazon EC2 or in other clouds with no code changes required.

    App2Container discovers apps running on a server, identifies their dependencies and generates relevant artifacts for seamless deployment to Amazon ECS and Amazon EKS. It also provides integration with AWS CodeBuild and AWS CodeDeploy for a repeatable way to build and deploy containerized applications.

    AWS App2Container generates artifacts such as Dockerfiles, container images in Amazon Elastic Container Registry (ECR), ECS Task definitions, Kubernetes deployment YAML, templates to set up a build/release pipeline in AWS CodePipeline and more.

    It can also be used to containerize ASP.NET (.NET 3.5+) web apps running in IIS 7.5+ on Windows and Java apps running on Linux.

    Code Review and Optimization

    Another handy tool that debuted this summer is Amazon CodeGuru. Powered by machine learning, this set of tools automatically reviews code for bugs and suggests potential optimizations. It includes two components:

    • Amazon CodeGuru Profiler—Helps developers find an app’s most expensive lines of code and then recommends how to improve the code to save money.
    • Amazon CodeGuru Reviewer—Helps improve code quality by using machine learning to identify critical issues and hard-to-find bugs during development.

    Do-It-Yourself Development

    One more recently released AWS service we want to mention is Amazon Honeycode. This one has the potential to be a big time-saver for customers. The fully managed, low-code/no-code development tool makes it easy to build powerful mobile and web apps quickly with no programming required.

    Customers can use a simple visual app builder to create highly interactive web and mobile apps, backed by an AWS-built database to perform tasks such as tracking data over time and notifying users of changes. They can get started creating apps in minutes and build applications for up to 20 users for free. After that, they pay per user and for the consumed storage capacity.

    What’s Next With AWS Is What’s Now

    AWS is continually developing and deploying services that make app development easier and more cost-efficient. You can put these new services to work to innovate more, get to market quicker, generate significant cost savings and much more.