Development Environments

Workbench

As a developer, it’s a great time to be alive. We have countless options for development languages and frameworks. But, sadly, many of them leave much to be desired in terms of tools and environments.

The Model Environment

As a veteran Java developer, I’ve been spoiled with excellent tools. We have numerous IDEs including Eclipse, NetBeans, and IntelliJ. Everyone has their preference, but all three are excellent. Likewise, we have numerous build and dependency management packages such as Maven and Gradle. We have test frameworks, automation frameworks, debuggers, profilers, and anything else you could want to engineer even the most complex of application. In short, Java provides the best development environment there is. Seriously. Few languages have IDEs as good as what Java has. Even fewer have tools that can complete with Maven or Gradle.

When Will Other Languages Catch Up?

I continue to see how Python is displacing other languages. But when will it catch up to Java in terms of development environment? Are there any IDEs that complete with Eclipse for Python? (NOTE: Eclipse can actually be used for Python, but it always seemed to me more of a hack than a real Python IDE) How about debuggers? Go ahead and try debugging Python or JavaScript code and you’ll quickly see how far behind Java they are. Not to mention dealing with libraries and environments!

A Call to Action

As we continue to shift to newer languages, I’m concerned that the next generation of developers will actually have a more difficult time than we do today. Why, as a development community, are we only focused on creating new languages but not on creating solid environments? How are Go, Python, Rust, and the myriad of other languages ever supposed to achieve the same widespread adoption of Java if we never had the rest of the tools we need to get the job done? I want to enjoy the benefits of some of the newer languages to come along. But, until they can complete with Java, I’m unable to stake the success of my customers on them.

Multilingual Programmers

One of the biggest difficulties in the computer programming world today is the sheer number of languages out there to use for application development. Which language should you learn? The reality is, that’s the wrong question. I recently spoke with a developer who indicated that he only knew C# – he was not comfortable with Python or any other language. For the professional developer, this it not an acceptable answer. In today’s world of programming, you can no longer get by knowing only a single language. For example, while the bulk of the code in a Java web application will be in Java, the front-end will require JavaScript and HTML. Build scripts may be written in Groovy or XML, and Shell scripts may be required for build automation. This is not unique to Java applications – just about any application will require some knowledge of other languages.

How do you pick which languages to learn? At a minimum, every professional engineer should know at least one compiled language such as Java, C, C++, or C# in addition to JavaScript, Python, and SQL. Additionally, he or she should be comfortable with another language such as Ruby, PHP, Go or Rust.

If you’re an application developer, do you only know one language? If so, I would strongly urge you to learn additional languages. Mastery of every language isn’t necessary, but any decent developer should feel capable of writing code in several languages.

Language Popularity

A subject that repeatedly comes up on websites, blogs, and conversations is which language is the most popular and which ones are the best to learn for future job opportunities. I keep an eye on this list myself as it’s important to understand trends within the software industry. However, people seem to ignore the most important aspect of language popularity – the context.

What do I mean by context? I mean we have to look deeper to understand why a language is as popular as it is. We also need to understand the market for a language and how that impacts popularity. For example, JavaScript is always near the top on any language popularity chart. Is it any coincidence that JavaScript is also the only front-end scripting language in use today? Whether or not you like JavaScript is utterly inconsequential. If you want a website with any manner of front-end scripting, you will use JavaScript. Likewise, if you want to interact with a database you use SQL and if you want a web page, it will be HTML. As such, these technologies will always rank more highly than those with a smaller market.

So what about Python? Everywhere you look, you see that Python is at the top of the list. Should we all switch to Python? Not really. What all those rankings fail to point out is the user base for Python. Certainly there are all kinds of production projects out there running Python. But if you look around, you see that Python’s popularity is largely caused by people outside the traditional developer community. AI researchers, academics, data scientists, system administrators, makers, etc. For non-programmers, Python is easy and incredibly powerful. But that hardly makes Python superior to other languages nor does it suggest that professional programmers should start porting their eCommerce sites.

Remember, while rankings of popularity may help you see trends, look to the underlying reasons. Why is it popular? Who is it popular with? Does this language look poised to overtake in other realms? When picking a language for a problem, the most important question is which language solves the problem best – not which language is the most popular.

Angular & MaterializeCSS

During the last year, I’ve developed numerous websites and mobile applications using the Angular framework. I’ve used numerous CSS frameworks as well such as Bootstrap, Ratchet, and Topcoat. But recently, a customer asked me to use MaterializeCSS. MaterializeCSS is a library of CSS and JavaScript code to easily create a material design experience for web applications. It’s quick, easy, and visually appealing. Unfortunately, getting some of the components to work with Angular proved difficult as the online documentation does not show how to setup Materialize for Angular. While most of the components do not require any JavaScript interaction by the developer, some components (such as select option lists or tabs) require initialization. The documentation says that tabs can be initialized by using:

var instance = M.Tabs.init(el, options);

Unfortunately, this won’t work in Angular as you’ll get numerous errors regarding undeclared variables. How can you hook this up properly?

First, declare the ‘M’ variable inside the page component below the imports. This will allow you to use the ‘M’ interface to MaterializeCSS from within your Angular code.

declare var M: any;

Next, get a reference to the object you are trying to interact with. This can be obtained by using a querySelector for the class of object you’re trying to initialize. For instance, tabs will be declared in HTML by assigning a class=”tabs” attribute to object. Once you have the object, you can initialize it by calling the appropriate method. This should all happen on the init method of your page object.

ngOnInit() {
  const elem = document.querySelector('.tabs');
  const options= {};
  M.Tabs.init(elem, options);
}

This is identical for any other object that requires MaterializeCSS initialization and can also be used to call any other functions in the MaterializeCSS framework.

With this information, you should be able to enjoy the benefits of Angular as well as the awesome UI elements of MaterializeCSS to their fullest!

Killer Robots

During the last year, countless tech leaders have talked about the danger that artificial intelligence could pose in the future. Like most people, I laughed at them. After all, do I really think that The Terminator or The Matrix were prophetic? Hardly. But the more I read and the more I pondered it myself, the more concerned I became. Now, I wonder if there’s any way to prevent it from happening at all.

Is it really reasonable to think AI could take over the world? Do we really think code will be so poorly written and that software testers will be so incompetent as to let AI robots kill humanity? Unfortunately, I do. Not intentionally, of course, but bad code that wasn’t properly tested will make it into the wild on robots. Consider all the system updates that have been performed on your computer or your cell phone. Think about all the app updates that happen every single day. Consider all the one star reviews for apps on the mobile stores. AI will be no different.

Consider all the potential causes of AI issues. Developer errors, inadequate testing, corporate release requirements, poorly defined ethics, unforeseen events, etc. Each one of these issues could cause AI to perform in ways it was not intended with potentially catastrophic consequences. Consider government AI being developed by the lowest bidder – wow, that’s scary.

The more I think about that, the more certain I become that AI will eventually cause huge problems to the world. As such, it’s imperative that we – the tech community – consider the limits of AI – not in regards to technology, but rather in regards to safety and security. Do we want AI police officers or soldiers? That sounds dangerous. Could Russian hackers embed “Order 66” into our own robot army? Do we trust robots with firearms to make the appropriate decision in a life-or-death situation?

My intent is not to sound like an alarmist, but rather to begin thinking about the issues now. If not, we may find it’s too late to do so later.

Picking a Server Platform

Many small businesses want websites or mobile applications that require server-side functionality. Often, this functionality includes a database to store user information. What options exist for a user? What are the pros and cons for each one? I will examine three different frameworks – Node and SQLite3, PHP and MySQL, and Tomcat. These represent just a small number of options available to a business – from small scale applications to enterprise solutions.

For small applications, I like Node and SQLite. Node is a simple platform to run server-side programming. Since it requires virtually no infrastructure, Node services can be installed and deployed in minutes.  Likewise, SQLite requires no installation. SQLite databases are a simple file that can be easily backed up or restored by copying the database file. While this framework is great for small applications, enterprise applications would benefit from more robust environments. Node and SQLite can work really well for small internal applications or to implement a small number of services using a small database.

Next up, PHP and MySQL. This combo is widely deployed on a variety of platforms. In fact, that’s one of the reasons I like it. Typically, service providers like GoDaddy have support for PHP and MySQL out of the box, so applications and services can be deployed without much effort.  PHP/MySQL is also more robust than Node/SQLite. On the negative side, PHP has a variety of versions that are substantially different and PHP code can easily become unmanageable if developers aren’t careful.  I like this solution for smaller customers needing a small number of services on an existing PHP server.

Finally, there’s Tomcat. This option is an excellent Java-based server bringing all the advantages of the Java programming language into a robust server environment. Tomcat can integrate with any database, but MySQL is a common solution. Tomcat is an excellent option for Java web applications or services, but suffers from one big problem – it’s the most complicated option to setup.  This option is best when a large number of users or a large database must be supported. This is the option I like to recommend for enterprise customers.

Numerous other databases and server platforms exist. Microsoft’s .NET platform can work great for customers who prefer Microsoft products and Ruby may be a desirable option for some customers too. As with all technology choices, server platforms must be selected based on customer requirements. Small customers appreciate rapid, low cost development while larger customers will want more robust solutions while being less price sensitive.

Language Overload

As a technology enthusiast, I live in a great time. Computing devices are everywhere, artificial intelligence is advancing by leaps and bounds, and hardware platforms such as Arduino and Raspberry Pi have made it easier for people to tinker with new technologies without spending a lot of money. But with all the great advances in technology, there is one advance I do not enjoy – the endless list of new programming languages released every single year. I’m not opposed to new languages, they are a necessary part of the march of progress. But don’t we have enough already? One example is the proliferation of languages that operate on the Java Virtual Machine. Originally just Java, now we have Scala, Groovy, and Kotlin too. And, each one has their own group of advocates saying their language is the best.

When Apple announced a few years back that they were replacing Objective-C, I was originally optimistic. Objective-C is pretty much unused outside the Mac world. If you wanted to write iOS applications, you had to learn an otherwise useless language. Was Mac going to lower the bar for new developers and allow them to use a language that was already widely used? Nope – they invented another language – Swift. I’ve heard lots of great things about Swift, but I’m not really interested in learning another niche language to develop for a single platform. (Instead, I’ve chosen to use hybrid tools such as Cordova and Ionic).

What’s the harm in all these languages? While different languages do bring different things to the table, there has to come a point where the market is over saturated. With all the languages out there, developers have to pick which ones to learn and which to skip. While every developer should be competent in more than one language, it’s certainly not realistic to expect a developer to be an expert in a dozen different languages. And since every language needs their own libraries of code, scores of developers are wasting their time writing standard functions for another language. Solving a problem that has already been solved a dozen times in the past – with a new language – is not particularly useful.

Where do we go from here? I suspect that we will continue to see the proliferation of languages. Long term, we will see languages transition to legacy code far sooner than previously. This will make it increasingly difficult for companies to maintain their codebase and will mean more frequent rewrites of software applications just to stay current. For companies, I would suggest ensuring that the languages you choose are solid, stable, mature, and likely to be around long term. You can go for the newest language out there, but you’ll struggle to find developers now and you’ll likely end up having an ever more difficult time maintaining the application long-term.

Getting Started with Artificial Intelligence

It seems that artificial intelligence is in the news more and more. Most larger companies use AI for something within their business, and more and more businesses are finding ways to improve their organization with AI. Purchase recommendation systems, self driving cars, video games, language translation apps, and route mapping software are just a few examples of artificial intelligence we see every day.

But where does someone interested in AI get started?  AI can be very complicated, but that doesn’t mean you can’t get involved too! One of my favorite resources for learning AI is the series Artificial Intelligence for Humans by Jeff Heaton. In his books, he covers a variety of topics including genetic algorithms, machine learning, clustering, linear regression, swarm algorithms, and so much more. While these topics can be complicated, Jeff presents them without all the math in a way that is far more readable than most texts on the topic.

If you are interested in AI, one of the first questions to answer is what programming language you want to use. While any language can be used for AI, the bulk of the tools and frameworks available exist for Java, C++, Python, and R. If you’re big into number crunching and Big Data, R may be the obvious choice. If you’re not a programmer, Python may be easier. For existing developers, Java or C++ may be best.

What type of AI do you start with? Try genetic algorithms or swarming algorithms. Genetic AI assumes the answer to be like a genetic genome and, through a series of mutations and genetic splicing, attempts to find an answer.  Swarming algorithms look at groups of objects and attempts to have them behave like a cohesive team. Swarming algorithms are great for games with AI controlled enemy armies and are commonly used by game developers. Other common, and simple, AI algorithms include K-Means clustering (used to group objects by similarity),  linear regression (used to predict unknown values using relatively simple algebra), or path finding algorithms such as Dijkstra’s Algorithm.

Once you understand the basics of AI, you can move onto frameworks like DeepLearning4J or TensorFlow to help create Neural Networks (a far more advanced type of AI) or look into libraries like OpenCV for tinkering with Computer Vision.

Whether it’s creating an emulation of a fish tank using swarming algorithms, solving the Traveling Salesman Problem using genetic algorithms, or calculating a path through a maze using Dijkstra’s Algorithm, artificial intelligence is loads of fun.

Angular is Awesome

Over the last six months, I have started doing a lot of Angular development. Initially, I was less than enthusiastic about the experience, but today it is probably my favorite technology. So, what makes Angular so great?

Angular provides a clean breakup of code, HTML, and CSS. Like MVC models for desktop or web applications, the Angular model ensures a clean separation of concerns allowing web designers to write HTML code while programmers handle the underlying logic.

Angular components are modular. I love this aspect of Angular development. I can create a cool widget in one application and easily use it in another application. This kind of modular approach reduces development times and allows for plug-and-play development of applications.

Angular applications run on the client side. As servers get more and more traffic, dealing with all the page requests can become burdensome for a web server. Running as much as possible on the client side not only improves user experience by improving speed, but also reduces load on your servers.

Angular applications use AJAX. This prevents full page reloads and just changes portions of the webpage based on user interaction. It looks slicker, feels better, and allows for all kinds of cool web experiences such as filtering and sorting data in a way that feels like a desktop application.

Angular applications easily consume REST services. This makes it easy to interact with countless services – whether homegrown or provided by a third party. Typically, REST services provide data in the form of JSON objects which need no manipulation to use in an Angular app. No parsing – just consume the data. It’s easy and convenient. Likewise, when sending data to JSON-based REST services, no translation is needed – just send the native JavaScript object to the server.

Angular can be used to create mobile applications. Ionic is a commonly used framework for creating hybrid mobile applications for both iOS and Android. Ionic provides an Angular framework as well as components to create awesome mobile applications.

Angular can use countless CSS frameworks. While not specific to Angular, I feel I would be negligent to not mention the amazing variety of CSS frameworks out there that can be used by Angular to create visually appealing web apps. Materialize CSS and Bootstrap are two of my favorites, but countless other libraries can be used allowing developers to create a beautiful experience for users.

If you’re not using Angular, you’re definitely missing out!

Solidity

Recently, I was contacted by a company that does cryptocurrency to write smart contracts. I’ve never done this before, but I have no problem learning a new language – particularly for a blockchain technology. So what is a smart contract? Smart contracts are an amazing technology that allows you to run code on the blockchain.  Code is written in a language called Solidity, which is similar to Java or JavaScript. Once the code is written, it’s deployed to the blockchain where it can be called by others later. It’s similar to a cloud application, except the cloud is the blockchain instead. It’s always available because there are always machines mining cryptocurrency. Many sources are exclaiming how this kind of technology will change the world, and it’s easy to see why. The ability to write contracts in code that will later be triggered will be hugely impactful to banking, insurance, and countless other fields.

So what does Solidity code look line anyway? Here’s a simple Hello World app in solidity:

pragma solidity ^0.4.24;

contract HelloWorld {
    event log_string(bytes32 log);
    
    function() public {
        emit log_string("Hello World!");
    }
}

If you’re interested in learning more about Solidity, check out the MetaMask plugin for Chrome as well as the Remix IDE and find yourself a good online video for Solidity development. I feel confident that the future holds countless opportunities for developers who master this technology!