What’s the Difference Between Static Class vs. Singleton Patterns in C#?

When developing apps with C# in the .NET framework, you have a choice between two single, shared class instances. Whether you decide to use a static keyword or a singleton design pattern depends on several factors, which are outlined in the article below.          

Key Differences Between Static Classes and Singleton Patterns

Put simply, a singleton is a pattern while a static class is a keyword. This means you can create one, persistent instance across an application’s entire lifespan with a singleton. The nifty thing about singletons is that a single instance can be used as a parameter for other methods. On the other hand, static classes only permit static methods and can’t be passed as parameters. 

QuickBooks vs TallyPrime

Overview

It's no secret that both QuickBooks and TallyPrime software are key dominant players in the Indian market. QuickBooks is a cloud-based accounting software from Intuit, with provisioning for Indian currency, Indian tax regulations, and automatic synchronization of QuickBooks accounting information with the Company’s bank transaction information. The best thing is its UI which is way better and is a monthly payment software, making it more convenient for SMEs. Tally Prime, on the other hand, is basically a one-time payment software and is especially for the Indian market, keeping in mind that the Indian enterprise-level organizations need a regulatory regime.

Evolution

QuickBooks was founded in 1983, and it has slowly but steadily climbed the ranks in order to become the giant it is today. Although it was founded in 1983, it took about 19 years to release the first version of QuickBooks. But, after the QuickBooks release, it went through a lot of changes and is still changing to this day; its software has evolved, adding more features and functionality. QuickBooks, at present, is available on a wider international scale throughout the globe. Tally, on the other hand, released its new version TallyPrime, which empowers business owners to be more efficient. Like QuickBooks, Tally has also gone through a lot of changes for the past 30 years, and at present, their newest version TallyPrime is on the Indian market.

What’s in a Name: Java Naming Conventions

Imagine a world without names. What would happen if nothing in this world had a name? This article would have been a very different story. Oh sorry, we wouldn’t even be able to tell the story. What about if we had weird names? Then what will aliens think about us? So, basically, everything is in the name, especially when it comes to programming languages.

Programming is a story; every character and scene needs to have a name that properly tells you what it is and what it does. You should be careful while naming things: You don’t want to make your code hard to read or debug. Remember: You are the creator here. You can name anything from babies, stars, trees, and mountains, almost anything (almost). Paying little attention to this feature will make your code more readable, easy-to-debug, and whatnot. And you should be able to look at it after months and be able to understand it without any trouble.

Introduction to Object Types (a.k.a. Classes) Part 1

Object types (classes)

PL/SQL is a procedural language — mostly. But it can also be used to implement object-oriented features in Oracle Database. In "from the ground up" object-oriented languages like Java, everything is defined in classes. In Oracle Database, we have object types.

In this post, I introduce you to the basics of object types and kick off a series exploring many of the features of these programming elements.

Could Grouping HTML Classes Make Them More Readable?

You can have multiple classes on an HTML element:

<div class="module p-2"></div>

Nothing incorrect or invalid there at all. It has two classes. In CSS, both of these will apply:

.module { }
.p-2 { }
const div = document.querySelector("div");
console.log(div.classList.contains("module")); // true
console.log(div.classList.contains("p-3"));    // false

But what about grouping them? All we have here is a space-separated string. Maybe that's fine. But maybe we can make things more clear!

Years ago, Harry Roberts talked about grouping them. He wrapped groups of classes in square brackets:

<div class="[ foo  foo--bar ]  [ baz  baz--foo ]">

The example class names above are totally abstract just to demonstrate the grouping. Imagine they are like primary names and variations as one group, then utility classes as another group:

<header class="[ site-header site-header-large ]  [ mb-10 p-15 ]">

Those square brackets? Meaningless. Those are there to visually represent the groups to us developers. Technically, they are also classes, so if some sadist wrote .[ {}, it would do stuff in your CSS. But that's so unlikely that, hopefully, the clarity from the groups outweighs it and is more helpful.

That example above groups the primary name and a variation in one group and some example utility classes in another group.

I'm not necessarily recommending that approach. They are simply groups of classes that you might have.

Here's the same style of grouping, with different groups:

<button class="[ link-button ] [ font-base text-xs color-primary ] [ js-trigger ]" type="button" hidden>

That example has a single primary name, utility classes with different naming styles, and a third group for JavaScript specific selectors.

Harry wound up shunning this approach a few years ago, saying that the look of it was just too weird for the variety of people and teams he worked with. It caused enough confusion that the benefits of grouped classes weren't worth it. He suggested line breaks instead:

<div class="media  media--large
            testimonial  testimonial--main"> 

That seems similarly clear to me. The line breaks in HTML are totally fine. Plus, the browser will have no trouble with that and JSX is generally written with lots of line breaks in HTML anyway because of how much extra stuff is plopped onto elements in there, like event handlers and props.

Perhaps we combine the ideas of line breaks as separators and identified groups... with emojis!

See the Pen
Grouping Classes
by Chris Coyier (@chriscoyier)
on CodePen.

Weird, but fun. Emojis are totally valid there. Like the square brackets, they could also do things if someone wrote a class name for them, but that's generally unlikely and something for a team to talk about.

Another thing I've seen used is data-* attributes for groups instead of classes, like...

<div 
  class="primary-name"
  data-js="js-hook-1 js-hook-2"
  data-utilities="padding-large"
>

You can still select and style based on attributes in both CSS and JavaScript, so it's functional, though slightly less convenient because of the awkward selectors like [data-js="js-hook-1"] and lack of convenient APIs like classList.

How about you? Do you have any other clever ideas for class name groups?

The post Could Grouping HTML Classes Make Them More Readable? appeared first on CSS-Tricks.

Top 17 Resources To Learn Test Automation In 2019

Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on new technology so soon.

Thankfully, there are plenty of resources to help you deal with your questions on test automation and guide you through the process of learning basics of automation testing to become skilled in test automation for web applications and mobile applications. In this article, we will cover some resources for test automation, ranging from blogs, workshops, and online video tutorials and more to help you brush up the basics of automation testing with in-depth tutorials. I believe every tester, whether beginner or experienced, should research them.

Why Do We Need an Interface in OOP?

Most of us feel confused about the usefulness of interfaces at a first glance. We have questions like “Why do we need interfaces?" and “What is the advantage of using interfaces?" In this blog, we will try to find the answers to these questions.

Let’s begin with a simple example. Assume that you are a student and need to prepare for an exam. You know that there will be distractions during your exam preparation. We will use mobile applications and friends as our example. Let’s describe each as a class:

Duplicate Objects in Java: Not Just Strings

When a Java application consumes a lot of memory, it can be a problem on its own and can lead to increased GC pressure and long GC pauses. In one of my previous articles, I discussed one common source of memory waste in Java: duplicate strings. Two java.lang.String objects a and b are duplicates when a != b && a.equals(b). In other words, there are two (or more) separate strings with the same contents in the JVM memory. This problem occurs very frequently, especially in business applications. In such apps, strings represent a lot of real-world data, and yet, the respective data domains (e.g. customer names, country names, product names) are finite and often small. From my experience, in an unoptimized Java application, duplicate strings typically waste between 5 and 30 percent of the heap. However, did you ever think that instances of other classes, including arrays, can sometimes be duplicate as well, and waste a considerable amount of memory? If not, read on.

Object Duplication Scenarios

Object duplication in memory occurs whenever the number of distinct objects of a certain type is limited but the app keeps creating such objects without trying to cache/reuse the existing ones. Here are just a few concrete examples of object duplication that I've seen: