Is Visual Studio Code really the best code editor?

Posted on February 28th, 2021

Developers are highly opinionated when it comes to code editors. Some people swear by Vim. Others are Sublime and Atom advocates. However, there is one particular contender that’s so prevalently mainstream that you can’t ignore it. This little big code editor is known as Visual Studio Code.

While Visual Studio is popular, does it deserve the title of being the best code editor? Let’s have a look at its history, pros, cons, alternatives, and if it is really the best code editor for developers.

How Visual Studio Code Got Crowned A King

Up until recent years, Microsoft and open-source weren’t considered friends. In 2021, Microsoft products are in use by most if not all developers (if you count GitHub). However, it was Visual Studio Code that paved the way for the tech giant’s rebrand through its initial release back in April 2015. With five years of bug fixes, feature releases, and an extensive free plugins ecosystem, its popularity has grown dramatically.

By 2016, Visual Studio Code ranked 13th among the top popular development tools on Stackoverflow. It didn’t take long for the little big code editor to reach the #1 spot according to the 2019 Developers Survey, with 50% of 87,317 respondents using it.

But why is it so popular? On the surface, it looks just like a typical code editor. However, there are few distinct features that tip a developer’s preference over towards Visual Studio Code.

Visual Studio Code is free, open-source, and cross-platform. This means that it works on Windows, Linux, and macOS.

Unlike many other code editors, Visual Studio Code has an in-built debugger, making the development flow less ‘clicky’ and maintains a single view with code and debugger. This makes the process of bug tracking, and code run-throughs a lot easier and faster. You don’t need to have multiple screens to run the different consoles and rearrange them each time you need to minimize something. It’s built into the design and your desired workspace set up.

In addition to this, there is intelliSense but built into the code editor. intelliSense is a form of predictive coding. With the addition of framework, library, and/or language plugin extensions, you can leverage this even further with ready-made boiler-plates.

Another major thing about the extension marketplace for Visual Studio Code is that it’s not limited to just code. There are productivity, custom debuggers, code linters, ssh-terminals, prettifies, and DevOps pipeline connections.

Although the major feature of Visual Studio Code is being a code editor, with the addition of extensions, it becomes more than just a code editor. With the right settings, extensions, and configured shortcut keys, it can easily become a full-stack workstation.

While this is nice, how does it stack up against the other players in the code editor game?

Pros, Cons, and Alternatives

It’s hard to judge a code editor without context. So let’s review a few other popular alternatives and how they compare to Visual Studio Code.

Sublime Text vs Visual Studio Code

For a long time, I clung to Sublime Text and refused to hop over to Visual Studio Code. In part, I didn’t want to buy into the hype, mostly out of fear that I’d be disappointed. However, I eventually laid down my initial prejudices towards Visual Studio Code and gave it a try. Let’s just say that I haven’t used Sublime Text in a while.

So what converted me?

Poor Sublime text : ProgrammerHumor

The main reason I stayed with Sublime Text was that it’s easy and quick to write and navigate code. Once you’ve figured out the keyboard shortcuts or configured your own, your productivity becomes tied to how quickly you can access certain features.

However, Sublime Text is just a code editor. Beyond editing code, it doesn’t do much. There’s no git integration or an onsite debugging tool like in Visual Studio Code. The barebones basics of Sublime Text were the original appealing feature, but as the development process increases in complexity, the general needs of a developer are not easily met by Sublime Text.

In contrast, Visual Studio Code can be classed as an integrated development environment (IDE), meaning that developers can write and test code at the same time. In theory, you can pair Sublime Text with a console – but that’s another thing to physically deal with while Visual Studio Code provides a cohesive solution.

Atom vs Visual Studio Code

In between using Sublime Text, I also experimented with Atom. Like Sublime, Atom is also another text editor with code support. The only major similarities that Atom has with Visual Studio Code is that they’re both built using Electron – a technology that allows developers to build desktop native apps using JavaScript, HTML, and CSS.

Atom was created by GitHub before the company was acquired by Microsoft. Despite being a competitor to Visual Studio Code, Microsoft has clarified that Atom’s existence and support will continue.

Atom allows for plugins and runs on the same general philosophy of extensibility – like Visual Studio Code. However, ATOM out of the box requires more configuration to turn it into an IDE. Visual Studio Code, in contrast, comes preconfigured with what you generally need to get started. This makes the ease of adoption much faster and easier than Atom.

Brackets vs Visual Studio Code

Like Atom and Sublime Text, Brackets is another free and open-source software. Its origins sit with Adobe. The major perk of using Brackets is that it supports preprocessing and live edits.

While this is highly useful for a frontend developer, backend development on Brackets is not recommended. Adobe is traditionally known as a visual and graphical-based company, so it makes sense that Brackets is more supportive of frontend development processes than any other parts of the software creation process.

This, however, isn’t a bad thing. The way Brackets is structured makes it easier for a new frontend designer to learn and understand how to code than jumping straight into any other code and text editor. The selling point of Brackets is that it supports LESS and SCSS with live previews and inline editors. But that’s as far as the extensibility goes.

The only reason I’d recommend Brackets to anyone is if they are a beginner at coding or learning how to navigate through CSS for the frontend. This is because Brackets is more like training wheels for frontend development. In contrast, Visual Studio Code is more for anyone that wants to code and create applications.

Vim vs Visual Studio Code

Vim stands for Vi improved. For the uninitiated, Vim can feel like a blast back to the stone age of programming. In part, this is brought on by its brutalist design – a visual style that’s in your face through its bold and loud statements. If you look at the download and support pages, the text looks dated and the color scheme is still in its original neon 90s green.

For many of us that grew up as developers immersed in workflow aesthetics, Vim is like a hard slap in the face kind of text editor. For many backend developers and DevOps, it works out just fine.

In part, this is because Vim is often used in the CLI. It takes a new developer a while to get familiar with the shortcut keys and the inability to use a mouse. However, this complete discard of a periphery is the thing that makes it highly effective for enforcing efficiency. The removal of mouse travel time means that you get used to using the keyboard shortcuts, helping you stay in flow for longer and therefore create more code.

But for many of us, that’s not how we code. There are often breaks required to compile and run code, to check and to test. The major benefactors from Vim are most likely those whose’ work predominantly lies in the console. Apart from that, Visual Studio Code just seems a lot less cumbersome to deal with in comparison.

How to Exit Vim Editor - Stack Overflow Blog
Stackoverflow developer survey 2019

The issue with Sublime, Atom, Brackets, and Vim is that they’re all just text editors. Visual Studio Code comes out of the box ready to run the basics of an IDE while providing the ability to be highly customizable.

Another major perk of Visual Studio Code is that it is supported on macOS, Windows, and Linux. This means that you can take your workspace settings to many platforms without much of a fuss. Visual Studio Code also runs faster than most code and text editors.

So is Visual Studio Code the best code editor?

For most web-related development, the answer is yes. While you can use Visual Studio Code for mobile application development, it does require more setting up than you’d have to do if you used Android Studio Code for Android development.

Breaking down arrays in C++

Posted on February 15th, 2021

Arrays are one of the foundations of data in almost every programming language. The idea of what an array is in C++ is not that much different from arrays in other languages such as Swift, Java, and JavaScript.

But what is an array? How does it work? And what does it look like in a C++ context?

Image result for c++

What is an array?

Imagine you had a piece of data. Under some circumstances, this data is a single piece of information. It can be assigned to a primitive type like a string if it is a set of letters, or an int if it is a number.

For example:

string car = "Tesla";
int phone = 8374827888;

However, some pieces of data can be complex. What if you wanted to hold more than just one piece of information against a single variable? What if you wanted a list?

This is essentially what an array is – a list. An array is a data type that can hold multiple values against a single variable. An array is identifiable through a pair of [] and looks something like this:

string cats[4] = {"tuxedo", "ginger", "black", "striped"};

The number inside [] signifies how many items there are in the list. The string declares the list as a list of string typed values.

But what if you don’t know the size of your array? Can you create an array without specifying how many items there are in the list? The answer is yes.

You don’t have to specify the array size and can write it with a pair of empty []. The array will only be as big as the number of items assigned.

For example:

string cats[] = {"tuxedo", "ginger", "black"};
//the size of the array is 3

On the surface, this just seems so much easier. However, in C++, if you specify the array size, it won’t be able to accommodate future values. In the above example, there is only enough space for three items. You can’t add any more to it easily without overwriting the original values.

When you specify the array size, you are preserving memory space for it. This means that you insert more items into the arrays as needed without being required to overwrite the entire array.

For example:

//when writing arrays with an unspecified number
string cats[] = {"tuxedo", "ginger", "black"};
//doing this won't work
cats[3] = "striped";
//but this will
cats[] = {"tuxedo", "ginger", "black", "striped"};

//however, when space is reserved, this will work
string cats[5] = {"tuxedo", "ginger", "black"};
cats[3] = "striped";

When you declare an array with the size attached, it also allows you to create an array without any values attached. This can come in useful if you want to add values later.

For example:

string cats[4];
cats[0] = "tuxedo";
cats[1] = "ginger";

It is good to note that in C++, you can’t create mixed type arrays. So, a piece of information that looks something like this cannot be assigned to an array.

{"tuxedo", 1, "banana", 1.34}

An array in C++ can be assigned against any primitive types available.

How to access arrays in C++

To access a specific value inside an array, you need to match its position in the list by signifying it inside the [].

For example:

string cats[4] = {"tuxedo", "ginger", "black", "striped"}
count << cats[0];
//outputs "tuxedo"

To change a value inside an array, you can just do it via the = assignment operator and matching it with the position inside the [].

For example:

cats[1] = "Ginger";
//ginger will now be Ginger

Looping through an array can be done through a for loop and looks something like this:

string cats[4] = {"tuxedo", "ginger", "black", "striped"}
for(int i = 0; i < 4; i++){
  cout << cats[i] << "n";
}

The i is representative of the index value and for every cats[i], the associated value will be printed.

Diving deeper into Arrays in C++

So that’s the syntax basics of arrays. But surely, there’s more to it than that. To quench your curiosity – you are very much correct.

When it comes to arrays in C++, it is a collection of items stored inside contiguous memory locations. This is why the array size needs to be declared, especially if you’ve got plans for it in the future.

Every time an array is created, memory is reserved for it. C++ is a highly efficient and strict language, meaning that it will only reserve as much memory as it needs and does not automatically scale.

The major advantage of arrays in C++ is that it allows random access of elements via the array’s index. It uses less code and can assign multiple elements at once. Running through an array is as simple as using a loop.

However, the drawback of arrays in C++ is that it works on a fixed number of elements. This means that once it’s created, you cannot add any more. This is because an array in C-based languages is not dynamically typed like it is in JavaScript.

What about Multidimensional Arrays in C++?

A multidimensional array is when there are more than one value inside a value. This sounds a little confusing, so let’s look at an example.

int x[2][4];

The above is declaring a data matrix that looks something like this:

        col 1   col 2   col 3   col 4
row 1 x[0][0] x[0][1] x[0][2] x[0][3]
row 2 x[1][0] x[1][1] x[1][2] x[1][3]

The actual data can look something like this:

int x[2][4] = {
  {1, 2, 3, 4},
  {5, 6, 7, 8}
}

As you can see, there are two rows of data with four columns inside each row.

For example, if you had something like this:

int x[2][3][4];

Your data would look something like this:

int x[2][3][4] = {
  {{1, 2, 3, 4},{5, 6, 7, 8},{9, 10, 11, 12}},
  {{13, 14, 15, 16},{17, 18, 19, 20},{21,22,23,24}}
}

To decrypt the above declaration, x[2][3][4] can be read as the following:

  • there are 2 rows of data
  • each row has 3 sets of data
  • each set of data has 4 values inside

It also means that the maximum value that x[2][3][4] can hold is 24 values. To loop through the array to get to a specific value, you’ll need to create loops with matching depths.

Final thoughts

That’s basically arrays in a nutshell for C++.

If you’re new to the concept, just think of it as a list, and to access a specific value, you only need the associated coordinates. The maximum number of values you can store inside an array is based on the multiplication of all its dimensions.

For example, x[3] will have a maximum of 3 values attached to it. x[3][3] will have a maximum of 9 values inside its array. x[3][4][5] will have 60 spaces available and provisioned storage associated with it.

14 best plugins for Eclipse IDE (100% free)

Posted on February 6th, 2021

1,667 available plugins and solutions on the Eclipse marketplace online! By the time you read this there are probably even more. If you venture beyond the official marketplace you will find hundreds of other plugins developed to be compatible with your Eclipse IDE. Sounds like a classic first-world problem; too many plugins to choose from.

Most of the available plugins you will never need and will never hear of. Some you might already be installing as part of your default IDE setup process on a new machine. However, it is safe to say that there are some gems out-there that you’ve yet to uncover in your journey toward faster, more efficient and bug-free code.

In this post, we’ve collected the top 14 most useful and helpful plugins to add to your Eclipse IDE. Geared mostly toward the Java developers among you, our list includes tools for writing, testing, analyzing and optimizing your code and workflows.

1. Spotbugs

spotbugs for eclipse screenshot

Spotbugs, the so-called spiritual successor of FindBugs, is an open source solution that uses static analysis to search for bugs in Java code. This community-maintained plugin checks for over 400 different bug patterns in your code, including null pointer dereferences, infinite recursive loops, bad uses of the Java libraries and deadlocks.

2. Tabnine for Eclipse

Tabnine is an AI autocomplete service that helps developers code smarter and faster. Tabnine uses AI to combine millions of open source programs with your own code’s context and deliver code suggestions as you type.

Tabnine for Enterprise provides a secure coding environment that allows teams and organizations to host and train their own AI models. This feature facilitates collaborative autocompletion across IDEs and enhances code security by keeping the codebase and AI model on secure corporate servers. With Tabnine for Enterprise, your development team can enjoy the benefits of powerful AI code assistance, which promotes more productive and error-free coding, all while ensuring the confidentiality and protection of your company’s data.

[cta_btn url=”https://www.tabnine.com/pricing/landing” label=”Start a free trial”]

3. CheckStyle

checkstyle for eclipse screenshot

The CheckStyle Eclipse plugin is a code validation tool to help you ensure your code adheres to certain coding standards. It does so by inspecting your Java source code and pointing out items that deviate from a defined set of coding rules.

4. SonarLint

sonarlint for eclipse screenshot

Designed like a spell-checker for code, SonarLint helps validate code quality as you write by underlining the flaws in your code on the fly. In addition to Java, it also supports JavaScript, PHP and Python.

5. Project Lombok

project lombok eclipse plugin screenshot

This open source project features plugins for most popular IDEs, including Eclipse and its offshoots (MyEclipse, Red Hat JBoss Developer Studio, JBoss Developer Studio (JBDS) and Spring Tools Suite). Aimed at reducing boilerplate code, Project Lombok is a Java library that saves you writing getters and methods, and enables automation of logging variables and more.

6. Maven

maven for eclipse screenshot

Apache Maven is a software project management and comprehension tool based on the concept of a project object model (POM). The plugin facilitates managing any Java-based project’s building, reporting and documentation from a central piece of information.(As of 2020, Eclipse has started to bundle Gradle and Maven into the Eclipse IDE for Java setup)

7. Gradle

gradle screenshot

As of 2020, Eclipse has started to bundle Gradle and Maven into the Eclipse IDE for Java setup. A relatively new build management tool, Gradle has quickly become one of the most popular ones around and is also considered one of the world’s top open source projects. Offering support for Java, C++, Python and others, it is the choice of millions of developers when managing and automating software delivery.

8. CodeMix 3

codemix 3 screenshot

If you’re looking to develop webapps and interfaces, you should probably check out CodeMix. In a way, it brings many VS Code features to Eclipse (and its offshoots) letting you develop in React, Vue, Angular and other frameworks in Eclipse. The subscription offers some additional services, like e-learning courses available directly in your IDE.

9. Jacoco

jacoco screenshot

An open source code-coverage tool that generates reports detailing how much of your code is covered by unit tests. Jacoco lets you create comprehensive test suites with results optionally exported to an HTML, XML, or text file. A must-have tool for thorough testing, Jacoco is compatible with both Gradle and Maven.

10. Quick JUnit

quick junit for eclipse screenshot

JUnit is a popular open source unit testing framework for Java development that has rightfully earned its wide adoption. While JUnit itself comes pre-installed with Java-oriented offshoots of Eclipse, the Quick JUnit plugin makes it faster and easier to use with comfortable shortcuts.

11. TestNG for Eclipse

testng for eclipse screenshot

Inspired by JUnit and aiming to provide a wider range of testing categories, TestNG is an open source testing framework that is both battle-tested and well-maintained. Though you can run TestNG from command line, this handy little plugin will let you run suites, groups or individual methods directly from your IDE.

12. OsgiEquinoxJ

osgiequinox

OsgiEquinox plugin provides hotswap support for Eclipse platform development or development of Eclipse plugins.

The main purpose of this project is to avoid infamous _change -> restart&wait -> check development lifecycle. Save&Reload during development should be standard and many other languages (including C#) contain this feature.

13. Spring Tools 4 – for Spring Boot

Spring tools 4 screenshot

The Spring framework is a popular Java dependency injection framework but it can be hard to tame without the right set of tools. This set of tools is Spring Boot and the Spring Tools plugin for Eclipse. With the ability to go from nothing to a running Spring Boot app in seconds, Spring Tools is your plugin for building Spring-Boot-based enterprise applications.

14. Groovy Development Tools (GDT)

Groovy Development Tools Screenshot

The Groovy programming language is far more than just an Eclipse plugin, but it’s worth getting to know this “chill” cousin of Java as a tool for writing comprehensive tests in your IDE. GDT adds full-featured IDE support including editors, wizards, content assist, debugging, refactoring and searching.

At the end of the day, most Eclipse plugins are a tradeoff as Eclipse is famously slowed and encumbered by a large number of plugins. Be sure to take the time evaluate each plugin you find interesting to measure its contribution to your productivity against its impact on the performance of your work tools.

JavaScript vs. TypeScript: Which one should you use?

Posted on February 4th, 2021

The web is now JavaScript. Not just desktop browser-based web – but also native mobile and desktop app web. It is, no doubt, the predominant language of choice for many frontend and backend developers. However, JavaScript on its own can turn into an unstructured mess. Numerous frameworks and libraries have spawned over the years, some more popular than others.

But there’s a little thing called TypeScript that’s taken a segment of the JavaScript community by storm. Ever since its adoption and integration into Angular, it is now a staple for many developers.

So what is TypeScript? Why does it matter? Is it better than JavaScript? and which one should you be using?

This is exactly what we’re going to find out.

What Is TypeScript?

To understand TypeScript’s inception and importance, you need to rewind the clock and imagine a few things.

Imagine a world where JavaScript did not have declared types, classes, interfaces, namespaces, arrow syntaxes, modules, and namespaces. That’s what JavaScript was like almost a decade ago. JavaScript software development was exploding everywhere but the scripting language was nowhere near as robust or ready as its traditional programming counterparts like Java and C++.

JavaScript, after all, was created in 10 days and no one really saw it as a major player in web development. The rushed Netscape commissioned scripting language was created to just work. There was no forward-thinking about the long-term structural and architectural growth of the code. For a long time, JavaScript was a kitschy 90s snowflake effect until Apple eventually killed Adobe Flash and any other proprietary software that tried to make itself the leader of the web.

JavaScript’s popularity grew due to its widespread support and implementation in browsers. This led to the growth of sites using JavaScript to create server connections and interfaces. However, over time, the complexity grew but JavaScript’s development still had a long way to catch up.

By the time the 2010s rolled around, developers saw a need to structure JavaScript or risk losing the agility and flexibility that the scripting language offered. But several things were missing – mostly support for implementation ideas that existed in other object-oriented languages such as classes and typing. Without these seemingly simple things, JavaScript was prone to fall into chaotic code within a few sprints.

This is where TypeScript came in. Microsoft created TypeScript to sit on top of JavaScript, a superset scripting language that compiled down into JavaScript but offering the additional benefits and ability to implement structural and architectural integrity.

In essence, TypeScript is JavaScript – but with added functionalities that may not be available in JavaScript yet. For example, at the time of TypeScript’s inception, the class keyword did not exist in JavaScript and was not supported until 2015 – almost 3 years after TypeScript was originally released.

Is It Better Than JavaScript?

In a way, TypeScript can be seen as what the future of JavaScript can look like. It is often a few steps ahead of JavaScript and offers developers tools and implementation methods of ideologies borrowed from other object-oriented programming languages that work.

But is TypeScript better than JavaScript?

This is a loaded question because TypeScript is JavaScript. It sits on top of JavaScript and acts more as structural support for developers. For many, TypeScript and JavaScript are so seamless that they are almost indistinguishable. You are essentially writing JavaScript code but with additional meta-information available, such as typings and scopes, for the scaffold to create structural checks against.

Vanilla JavaScript, however, is something that many developers aren’t quite as versed in. Many JavaScript developers tend to start their coding journeys by working with libraries and frameworks such as node.js, React, Vue, and Angular. These libraries and frameworks have their own methods of using and implementing JavaScript.

React uses JSX, which is another JavaScript syntax extension like TypeScript – but the syntax implementation is very different from how TypeScript works. While TypeScript was inspired by Java, JSX leans closer towards PHP.

This brings us back to our original question, is TypeScript better than JavaScript?

The answer to this is – depends. The context, frameworks, and libraries used can influence the final architectural and structural outputs. For many projects, a traditional object-oriented structural approach can be beneficial and this is what TypeScript offers as a JavaScript extension.

TypeScript vs. JavaScript 

The perks of using TypeScript comes in when it is used as a structural and communication tool between developers. Code, after all, is just an encapsulation and translation of business rules.

Google’s Angular framework uses TypeScript as its structural and architectural basis. This is because TypeScript enables the framework to leverage the module approach to structuring frontend applications. In order to create a robust and consistent application, JavaScript’s untyped nature needs to be typed. There is no easy way to do this in JavaScript. TypeScript allows developers familiar with object-oriented to uplift ideas and transpose them over to the JavaScript project.

For example, here is a simple Angular TypeScript file for an empty login component.

import { Component, OnInit } from ‘@angular/core’;

@Component({
  selector: ‘app-login’,
  templateUrl: ‘./login.component.html’,
  styleUrls: [‘./login.component.css’]
})
export class LoginComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}

This is what it would look like if we were required to write it out in vanilla JavaScript.

import { async, ComponentFixture, TestBed } from ‘@angular/core/testing’;

import { LoginComponent } from ‘./login.component’;

describe(‘LoginComponent’, () => {
  let component: LoginComponent;
  let fixture: ComponentFixture<LoginComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ LoginComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(LoginComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it(‘should create’, () => {
    expect(component).toBeTruthy();
  });
});

Here is another example of a barebones TypeScript file in Angular.

import { Component } from ‘@angular/core’;

@Component({
  selector: ‘app-root’,
  templateUrl: ‘./app.component.html’,
  styleUrls: [‘./app.component.css’]
})
export class AppComponent {
  title = ‘AngularFirebaseAuth’;
}

Here is what the vanilla JavaScript looks like to achieve the same effect in Angular.

import { TestBed, async } from ‘@angular/core/testing’;
import { AppComponent } from ‘./app.component’;

describe(‘AppComponent’, () => {
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent
      ],
    }).compileComponents();
  }));

  it(‘should create the app’, () => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.componentInstance;
    expect(app).toBeTruthy();
  });

  it(`should have as title ‘AngularFirebaseAuth’`, () => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.componentInstance;
    expect(app.title).toEqual(‘AngularFirebaseAuth’);
  });

  it(‘should render title’, () => {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.detectChanges();
    const compiled = fixture.nativeElement;
    expect(compiled.querySelector(‘.content span’).textContent).toContain(‘AngularFirebaseAuth app is running!’);
  });
});

By comparison, vanilla JavaScript appears much more verbose than its TypeScript counterpart. The TypeScript version is much more comprehensive by nature and provides a basic implementation of traditional object-oriented syntaxes for developers and enforcing it in JavaScript when it gets compiled and translated over.

The object-oriented roots of TypeScript allow for predictability, readability, and leverage into a lot of object-oriented ideas that are not easily accessible in vanilla JavaScript. This is not to say that implementation of such ideas is impossible – it is just cumbersome to achieve in an effective and efficient manner.

TypeScript, overall, looks great. But where does it fall over?

The major drawback is that you still need to compile your TypeScript file into a JavaScript package. It needs to be transpiled first before it becomes useful. This is because browsers only support JavaScript and TypeScript sits on top of JavaScript.

Another thing to note about TypeScript is that it doesn’t implement true static typing. It is just a feature that sits on the TypeScript layer. This is because JavaScript itself doesn’t have this feature.

For those unaccustomed to object-oriented programming, TypeScript’s code structure can feel bloated. While it slims down the task of writing JavaScript, it is replaced with a lot of syntax sugar. It is also an extra layer of JavaScript to learn, in addition to also learning JavaScript itself.

Is TypeScript Worth It?

The quick answer is yes.

TypeScript is not required to be attached to frameworks and libraries like Angular and Nest.js. The JavaScript extender can exist as its own project. The only additional thing that you have to do is transpile it into JavaScript if you want to deploy and run it in your chosen JavaScript supported environment.

Overall, TypeScript is JavaScript but with added benefits for developers. These benefits include the ability to create better structural and architectural integrity in the JavaScript code and reduce the amount of vanilla JavaScript you need to write. The trade-off is that you will have to write more code than needed for smaller applications and transpile it before deployment.

Top 8 ebooks to learn Java in 2021

Posted on February 2nd, 2021

In 2021, Java is still the best programming language to learn. Especially if you want to learn a programming language that is both useful in the real world and instrumental in understanding how object-oriented programming works from the ground up. 

If you’re looking to study Java from scratch or improve your Java skills the selection of resources can be overwhelming. Video tutorials, text tutorials, references, online courses, and interactive apps are abundant, and many of them come with the promise of a record-fast super-easy learning experience. Most of them deliver what I perceive as an inferior result.

Why Books?

To me, titles like “Learn Java in a Day” sound about as effective as “Learn Dentistry in a Weekend”. Sure, you might know a thing or two after speeding through such a tutorial, but I personally wouldn’t let you anywhere near my teeth or mission-critical Java applications.

Call me old, but I still believe that books, whether printed or viewed on an e-reader, are the best resource for learning a programming language. Not only are books more comprehensive and complete than any online tutorial or app, they are usually easier on the eyes and leave less room for distractions from actual learning. Books don’t have social media app notifications popping up – an undeniably helpful feature.

The Top 8 eBooks to Learn Java

I am not alone in thinking that books are superior method  of self-learning. In fact, there are so many of them on Amazon alone, you can’t even load the full list as it exceeds the number of items you can fetch. Only the top 5000 appear. Since you probably don’t have the time or inclination to go over reviews for thousands of books on Java, we did the work for you.

The top eight books we’ve selected are recommended and relevant for both the complete Java newbie and the advanced Java programmer looking to hone their skills. If you are the later you might recognize books you’ve seen on the desks of coworkers or perhaps even own one or more of them yourself.

1. Head First Java by Kathy Sierra & Bert Bates

This book published by the well-known and trusted O’Reilly publishing house was the first step into Java for many programmers over the past decade. Not to be judged by its somewhat comical cover, Head First Java provides a thorough overview of OOP concepts and delves into topics like distributed computing and remote deployment.

Some may claim the fact it was published over ten years ago (and so does not make use of the latest versions of Java) makes it somewhat outdated. However, it continues to be popular thanks to its engaging story-telling, illustrations and puzzles. Some users even describe the book as “the first GUI-based technical book”.

Price: O’Reilly publishing offers a subscription service with access to several eBooks (including this one), audiobooks, training materials, and more. Subscriptions start at $39 / month. Also available on Amazon starting at $14.50.

2. Java: A Beginner’s Guide, Eighth Edition by Herbert Schildt

If you’re looking for something a little more up-to-date and a lot more in-depth, you should take a look at Java: A Beginner’s Guide, Eighth Edition, written by bestselling author and leading Java authority Herbert Schildt. Updated and revised for long-term support release Java SE 11, this book is one of the most comprehensive ones out there. It manages to make for a good addition to the shelf of any experienced Java programmer, while remaining accessible to anyone with basic programming knowledge.

Price: Starts at $23.50 for a Kindle edition on Amazon.

3. Java 9 Programming By Example by Peter Verhas

Published by Packt, Java 9 Programming By Example is, as the name suggests, for people who like to learn from examples and can’t wait to get doing. This book attempts to bridge the gap between learning and doing by providing real-world examples that promise to improve your software development skills.

Price: the eBook is $18. If you subscribe to the Packt subscription (starts at $9.99 / month) then you get free access.

4. Effective Java, 3rd Edition by Joshua Bloch

Some claim this book is a must-read for every Java developer, and previous editions of it won the Jolt award. With the book author also being the author of popular Java classes and APIs, like java.lang and Java Collection framework, it’s worth a read. Especially if you’re looking to focus on learning and applying best practices in your Java code.

Price: available for a one time payment of $35.19 for a Kindle edition or also available as part of the O’Reilly subscription.

5. Java Concurrency in Practice by Brian Goetz and Tim Peierls

Although somewhat outdated as it only covers Java 5, Java Concurrency in Practice is still a highly recommended resource for Java programmers looking to understand concurrency and multithreading in Java. It’s important to note that this is not an easy read, but considering how complex the topic discussed is, it actually does a fair job at explaining it in depth.

Price: Amazon has an available Kindle version for about $27.50.

6. Java: The Complete Reference, Eleventh Edition by Herbert Schildt

One of the latest, freshest, most complete and up-to-date books on Java is without a doubt the Complete Reference by Herbert Schildt.

In over 1,000 pages from one of the best-selling authors of programming books for Java developers, you will find pretty much everything.

From a deep understanding of the entire Java language, including its syntax, keywords, and fundamental programming principles to an introduction to JShell, Java’s interactive programming tool – it really is a complete reference.

Price: 34.10 for a digital Kindle edition.

7. High-Performance Java Persistence by Vlad Mihalcea

This book is for advanced Java programmers interested in learning more about how Java works with databases and vice-versa.

High-Performance Java Persistence tries to bridge the gap between application developers and database administrators, demonstrates how you can take advantage of JPA and Hibernate without compromising application performance. It also delves into jOOQ and its type-safe querying capabilities.

Price: eBooks start at $25.

8. Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin

The last book on our list is not a Java book, but rather one that will make your programming better regardless of what language you use.

Helping eliminate common coding errors and introducing best practices for writing good code (rather than just code that runs), Clean Code is a book highly recommended for anyone who wants to move up in the programming world.

Oh no! How could we leave out [insert your favorite book for learning Java here]? You’re more than welcome to educate us in the comments. Which book do you think every Java programmer should learn from?

Top 17 plugins for Android Studio

Posted on February 1st, 2021

There are hundreds of plugins out-there for Android Studio and the number grows daily. This is mainly due to two reasons. The first is the fact that Android Studio is the industry accepted go-to IDE for creating Android apps. The second is Intellij IDEA, the platform upon which Android Studio is based, that allows for the development and easy installation of (mostly) useful plugins that are compatible with both IDEs. But which do you install, if at all?

Of course, you can go ahead and start coding on a clean installation of Android Studio, with just the necessary libraries installed and zero plugins added. But you’re smarter than that. You’re looking to install the Android Studio plugins to make your work more efficient, intelligent, and (when possible) fun. Worry not, as we’re here to direct you to the current top of the crop of Android Studio plugins that are bound to (at the very least) triple your productivity.

In our list of the top Android Studio plugins we included some must-have basic tools, as well as a number of little-known gems recommended by seasoned Android app devs in the Tabnine user community. So following our list of best IntelliJ plugins, here’s our favorite AS plugins:

1. String Manipulation

string manipulation plugin
Pretty much what the name suggests, this plugin can save you hours of tedious manual work. Among others, it offers style toggling (camelCase, kebab-lowercase, KEBAB-UPPERCASE, snake_case, SCREAMING_SNAKE_CASE, dot.case, words lowercase, Words Capitalized, PascalCase), Un/Escape, Encode/Decode, Increment/Decrement, natural order sorting, filtering and alignment.

2. Tabnine

 

A bit of a shameless plug(in). The Tabnine plugin uses machine learning to crowdsource code-completions from millions of Java programs, combined with your own unique context. Used by both beginner and senior Java developers, Tabnine makes development faster and helps eliminate those irritating errors that pop up in your code. In addition to the plugin, Tabnine also offers an extensive library of commonly used code snippets to copy and paste where you need it.

[cta_btn url=”https://www.tabnine.com/pricing/landing” label=”Start a free trial”]

3. CPU Usage Indicator

cpu usa
This simple UI plugin is more handy than one might initially think. As your code and app get more complex to compile and run, this will take a toll on your CPU. One of the most useful things about CPU Usage Indicator is the ability to generates a thread dump to show you what it is the IDE might be doing in the background to clog up the CPU.

 4. Rainbow Brackets

rainbow brackets plugin

Nested brackets and parentheses have been a source of headaches for programmers as far back as this coder can remember (highschool). Many hours were lost looking for that missing bracket than is mucking up compilation. No more! Instead of sitting there for what seems like eternity trying to remember which number bracket you’re staring at? Add some color to your brackets and parentheses with the Rainbow Brackets plugin!

It supports Java, Scala, Clojure, Kotlin, Python, Haskell, Agda, Rust, JavaScript, TypeScript, Erlang, Go, Groovy, Ruby, Elixir, ObjectiveC, PHP, HTML, XML, SQL, Apex language, C#, Dart and others, most of which you really don’t need for Android development.

5. Project Lombok

Complex Java code for Android applications can often contain a lot of boilerplate code (constructors, getters, setters, etc). This can lead to lengthy, difficult to read, and tedious to maintain methods. Project Lombok is a Java library that plugs into your IDE and generates those boilerplate code, keeping your code short and readable. The difference between pre and post Lombok code can be quite staggering.

It’s worth noting that being a compile-time only library, Lombok will not make your app any heavier. In addition, the Project Lombok website offers a lot on helpful resources for plugin users and developers.

6. Android Drawable Importer

drawable importer

If you’re going to be working with drawable in your Android development, and there’s a very good chance you are, this is the first plugin you need to get to know. To adapt to all Android screen sizes and resolutions, every Android project contains a drawable folder.

If you’ve been blessed with a designer from heaven who provides the assets already in the correct folder with the correct naming, we’re jealous. Odds are, you’re not that blessed and have already found yourself manually renaming and moving the PNG files to the correct folders.

Unless you find this activity to have therapeutic value, Android Drawable Importer is the plugin that is going to save you a ton of time. It lets you import single assets to be adjusted for necessary sizes and resolutions, whole zip files to sort automatically to their folders, and batch-processing of multiple assets to integrate smoothly into the project.

7. Vector Drawable Thumbnails

To preview a vector drawable xml file you would normally need to build your app. To save you the trouble, Vector Drawable Thumbnails displays all Android vector drawables in the entire project with one click.

8. Android Drawable Preview Plugin

When you have a lot of drawable components in your project, remembering which is which can get hard. Wouldn’t it be nice if you had a quick preview of the image in your IDE? With Android Drawable Preview Plugin, you do.

This Android Studio plugin replaces the default icons with drawables previews inside the project view. Super-easy to access, but not an excuse to use ambiguous names for the drawable assets. Keep it descriptive, always.

9. Name That Color

name that color

Let me start by busting a myth. Not all women can tell the difference between turquoise and teal, or eggplant and plum. The very much female writer of these lines is one such example. And I am not even color-blind.

The existence and popularity of this plugin indicate that most developers don’t have that magical color-recognition skill either, so I am in good company.

The Name That Color plugin will name the color you have in your clipboard directly inside your color resource file in Android Studio, and give the name of the closest matching color. No more “lighter_light_pink” in your xml.

10. bundletool

bundletool is the underlying tool that Gradle, Android Studio, and Google Play use to build an Android App Bundle or convert an app bundle into the various APKs that are deployed to devices. This tool by Google is a must-have for more efficient APK packages.

11. Butterknife Zelezny

Android ButterKnife is a “View Injection Library for Android”. It generally improves code readability, letting you to focus on the logic rather than glue code for finding views or adding listeners.

butterknife zelezny

Developing with ButterKnife allows you to perform injection on arbitrary objects, which can get pretty complicated and tedious once you need to perform more than one or two. At this point, you need to refer to all layout XMLs to write them in the source file. Or you can simply install ButterKnife Zelezny.

Android ButterKnife Zelezny is an Android Studio Plugin for generating ButterKnife injections from selected layout XMLs in activities, fragments or adapters. In fact, most ButterKnife coding tutorials and guides you’ll find recommend you install Zelezny.

12. Android Input

Android Input is a fairly simple but useful Android Studio plugin that allows to easily type text directly into your Android device or emulator. It remembers the last used device and last text entered.

AndroidInputDemoSmall

13. ADB Idea

This plugin for both Intellij IDEA and Android Studio adds a number of useful shortcuts to various ADB tool commands directly in your IDE. While this seems like a small addition, developers say ADB Idea can speed up development and debugging of Android apps.

14. adb-enhanced

Dubbing itself “a Swiss-army knife for Android testing and development”, adb-enhanced is a command-line interface to trigger various scenarios. It lets you play around with many potentially buggy app behaviors like screen rotation, battery saver mode, data saver mode, doze mode, and permission granting/revocation.

15. ADB WIFI

This plugin simplifies connecting the device to the ADB through WiFi for debugging. Like many other small but handy plugins, this one is simply a shortcut to a series of commands you can execute in the command line. But why not be comfortable?

Dragon on Google 16. Here there be dragons

Here be dragons is an Intellij/Android Studio plugin that lets you annotate your impure Java methods with the @SideEffect annotation and shows a little dragon icon in the gutter when you call them.

 here-be-dragons

In addition to visually isolating impure functions, this plugin is just too cute not to include in our list. Because dragons.

boom 17. Power Mode 2

You know your code is epic. On some particularly long hyper-caffeinated coding sessions, you can feel your fingers spitting fire and shaking the world. You are a development God, and as such, deserve to code like one.

power mode 2

You might want to disable the shaking effect unless it syncs with the shakes from all the coffee. We won’t judge.

One last thing…

Before you go ahead and batch-install all the plugins from the list, you should remember that more plugins usually means a slower IDE. Consider your coding habits and see what plugins will shave off time-consuming tasks without adding unnecessary extra weight to Android Studio.