Here I am with another useful design pattern for you — the adapter design pattern. I will also highlight the differences between the decorator design pattern (see my previous article, Decorator Design Pattern in Java, here) and the adapter design pattern.

Adapter Design Pattern

  • The adapter design pattern is a structural design pattern that allows two unrelated/uncommon interfaces to work together. In other words, the adapter pattern makes two incompatible interfaces compatible without changing their existing code.
  • Interfaces may be incompatible, but the inner functionality should match the requirement.
  • The adapter pattern is often used to make existing classes work with others without modifying their source code.
  • Adapter patterns use a single class (the adapter class) to join functionalities of independent or incompatible interfaces/classes.
  • The adapter pattern also is known as the wrapper, an alternative naming shared with the decorator design pattern.
  • This pattern converts the (incompatible) interface of a class (the adaptee) into another interface (the target) that clients require.
  • The adapter pattern also lets classes work together, which, otherwise, couldn’t have worked, because of the incompatible interfaces.
  • For example, let’s take a look at a person traveling in different countries with their laptop and mobile devices. We have a different electric socket, volt, and frequency measured in different countries and that makes the use of any appliance of one country to be freely used in a different country. In the United Kingdom, we use Type G socket with 230 volts and 50 Hz frequency. In the United States, we use Type A and Type B sockets with 120 volts and 60 Hz frequency. In India, we use Type C, Type D. and Type M sockets with 230 volts and 50 Hz. lastly, in Japan, we use Type A and Type B sockets with 110 volts and 50 Hz frequency. This makes the appliances we carry incompatible with the electric specifications we have at different places.
  • This makes the adapter tool essential because it can make/convert incompatible code into compatible code. Please notice here that we have not achieved anything additional here — there is no additional functionality, only compatibility.

To better understand this, let’s look at an example of geometric shapes. I am keeping the example relatively simple to keep the focus on the pattern. Suppose we have a project of drawing, in which we are required to develop different kinds of geometric shapes that will be used in the Drawing via a common interface called  Shape.

Source de l’article sur DZONE

Previously, we saw some of the very basic image analysis operations in Python. In this last part of basic image analysis, we’ll go through some of the following contents.

The following contents are the reflection of my completed academic image processing course in the previous term. So, I am not planning on putting anything into the production sphere. Instead, the aim of this article is to try and realize the fundamentals of a few basic image processing techniques. For this reason, I am going to stick to using SciKit-Image – numpy mainly to perform most of the manipulations, although I will use other libraries now and then rather than using most wanted tools like OpenCV


Source de l’article sur DZONE (AI)

We’ve put together this article by talking to the people involved in software modernization projects (in leading positions) here at ObjectStyle. The goal is to help decision-makers choose an optimal software modernization strategy. The post covers some common use cases and approaches to legacy software redesign. It’s also centered primarily around enterprise software development because these are the kind of projects we do most of the time.

What Is Legacy Software

The term "legacy software" is usually applied to a software system that was written decades ago in an outdated programming language, using some no-longer-supported framework(s), according to dated design principles, and/or that is currently running in an increasingly unsupportable environment.

Source de l’article sur DZONE

Our team at DigiMantra Labs consists of many developers, but it has been dominated by frontend developers after the rising popularity of various JavaScript libraries like AngularJS, React.js, and others. We have moved to Microsoft Visual Studio Code and have long forgotten Sublime Text, but it’s a little secret that we still have developers that like "Dreamweaver." Yes, they do exist!

During one of our workshops, “Learn & Rise,” we discusses the various extensions that we use every day to make our lives easier. I collated them all and I’m going to share the top five VSC extensions that our developers use.

Source de l’article sur DZONE

Lizzie is a dynamically compiled scripting language for .NET, allowing you to incorporate dynamically loaded pieces of code into your C# and F# projects. One of its defining traits, is that, first of all, out of the box, it is literally theoretically impossible to execute malicious code, simply since out of the box, it doesn’t contain a single piece of functionality that changes the state of your computer in any way. If you need such functions, which I assume most would, then creating such functions is as easy as marking your method with an attribute, and making sure it has the correct signature. Below is an example.

using System;
using lizzie; class MainClass
{ [Bind(Name = "write")] object Write(Binder<MainClass> binder, Arguments arguments) { Console.WriteLine(arguments.Get(0)); return null; } public static void Main(string[] args) { // Some inline Lizzie code var code = @" var(@foo, function({ +(bar, ""world"")
}, @bar)) write(foo(""Hello "")) "; // Creating a Lizzie lambda object from the above code, and evaluating it var lambda = LambdaCompiler.Compile<MainClass>(new MainClass(), code); lambda(); // Waiting for user input Console.Read(); }
}

Notice how we "bind" a C# method in the above code to our Lizzie lambda object. This makes the C# method available as a "function" internally within our Lizzie code. This trait allows you to easily extend the language, with whatever domain specific extensions you need to solve your particular problem. This makes the language particularly well suited for "Domain Specific Languages."

Source de l’article sur DZONE

Analytics forms a major part of the conceptual design of an app. Data tracking and collection for the purpose of analytics allows us to better update our app for consumer use. Data tracking is akin to the idea of feedback from a user. By collecting the data in a way that makes sense to us, we can add features or upgrade the existing elements of our app to meet the demand of the consumer. While this allows for a certain level of automatic feedback it does not mean that we can outright ignore our app users’ comments either. A firm balance of both is the middle ground that we should be chasing.

Relevant Data Tracking

As a developer, data tracking is simply one more SDK that needs to be built into our existing application framework. We obviously don’t need every bit of information the app can collect – most of this is useless to our determination of whether the app functions as expected or not. We can, however, produce separate use cases to test whether users find a certain button layout more conducive to their app use. We can also collect information such as uninstall/reinstall information, the orientation of the device, loading time of the application and, by extension, its performance on a number of different handsets (very useful in benchmarking the processing friendliness of the application), account information, and, of course, crashes and exception data that can help improve our user experience. David Cearley from Gartner Inc. is noted as saying that every app now needs to be an analytics app and we can only do this through tracking the data relevant to our app.

Source de l’article sur DZONE

After my article, “Role of Project Manager in Data Science”, a couple of program managers suggested me to elaborate the use case on meeting release commitments. We are going to explore simulation, one of the amazing concepts in Artificial Intelligence. Quantitative analytic techniques, such as the Monte Carlo simulation, helps program managers in decision making through probabilistic distributions of potential outcomes.

Monte Carlo relies heavily on the randomness of key variables in solving the problem. Along with key parameters, we also need to understand the relationship between them and sufficient data to analyze further. The five steps listed in “Forecasting the future: Let’s rewind to the basics” are essential to building an accurate model.


Source de l’article sur DZONE (AI)

Factories have witnessed a sea change in the past three decades. The 80s and 90s witnessed Industrial Automation and robots came to the forefront. During the past decade, multiple game-changing technologies are reshaping the factories. Machine Learning, Internet of Things (IoT), Big Data, Virtual Reality (VR), and Artificial Intelligence (AI) are fundamentally alerting the way factories work. Their impact is not limited to manufacturing, they are influencing almost every industry. This article tries to explain Machine Learning and its significance in the world of manufacturing.

First, let’s try and explain Machine Learning. Simply put, it refers to algorithms improving on their own. Normally, when a program is written, it is expected to deliver a prespecified output for a given set of inputs. Over time, they identify patterns and “learn” to generate an output corresponding to a different set of inputs. In cases, algorithms learn to respond to new situations, e.g. algorithms on the trading floor “learn” to respond to different market situations. Machine Learning can be implemented through Decision Tree Learning, Association Rule Learning, Artificial Neural Networks etc.


Source de l’article sur DZONE (AI)

Have you ever played the video game Super Mario Bros.?

There is a good chance a majority of the DZone audience have played or watched someone play the flagship game from Nintendo, that was originally released in 1985 for the Nintendo Entertainment System.

Source de l’article sur DZone (Agile)

I finished my first full marathon in Richmond, VA a couple of weeks back which was a huge accomplishment and a fulfilling experience. While I have run a couple of 10Ks and did a half-marathon last year, I was a bit intimidated thinking about the uphill task to run a full marathon until one of my leaders (who has run many!) asked me to think about it and join a marathon training team.

Instead, I downloaded a training plan and started following it religiously like “weekly Sprints.” As a part of this journey, I also included my team of newbie runners and inspired them to run a half-marathon. Although they were a bit wary in the beginning and frustrated at times when their runs were in 80+ degrees and extremely humid weather in the summer, they finished strong by completing 2 half-marathons this year!

Source de l’article sur DZone (Agile)