DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Languages Topics

article thumbnail
Comparing Golang with Java
The first impressions of a Java enthusiast when looking at Go's features.
May 11, 2016
by Peter Verhas DZone Core CORE
· 75,166 Views · 25 Likes
article thumbnail
A Polyglot's Guide to Multiple Dispatch Part 4: Clojure
The conclusion of this series about multiple dispatch focuses on using the technique in Clojure.
May 11, 2016
by Eli Bendersky
· 6,232 Views · 1 Like
article thumbnail
Best Practices for Configuring Optimal MySQL Memory Usage
Tuning any database for maximum performance is crucial to most any application. We have a look at some of the bets practices for tuning one important aspect of MySQL: memory usage.
May 11, 2016
by Peter Zaitsev
· 21,081 Views · 1 Like
article thumbnail
Restful Java Metering by Dropwizard Metrics
Dropwizard has taken the Java world by storm with it's ease of use and great functionality. The metrics library is particularly powerful for anyone wanting to measure statistics in their Java applications.
May 10, 2016
by Thamizh Arasu
· 22,065 Views · 6 Likes
article thumbnail
Major Benefits and Limits of Autowiring in Spring Java Web Development
In this post, you will learn about autowiring—its limitations, advantages, and disadvantages in detail. You also get to know about different modes of autowiring used in Java web development.
May 10, 2016
by James Warner
· 101,981 Views · 4 Likes
article thumbnail
Is Polyglot Programming Practical?
This article discusses the history of polyglot programming, and considers whether it's still a valid premise.
May 10, 2016
by Keith Gregory
· 26,439 Views · 46 Likes
article thumbnail
A Polyglot's Guide to Multiple Dispatch Part 3: Common Lisp
Part 3 on multiple dispatch goes back to the roots of the concept from Common Lisp
May 9, 2016
by Eli Bendersky
· 24,888 Views · 3 Likes
article thumbnail
Domain Object Persistence
Persistence is a part of almost every Java enterprise application. Unfortunately, persisting domain objects is a non-trivial task. On the contrary, it generates a lot of problems, especially when we're using a relational database. Let's see different approaches to the problem.
May 9, 2016
by Grzegorz Ziemoński
· 15,431 Views · 9 Likes
article thumbnail
Some Nuances of JavaScript Types
Not everything in JavaScript is an object, and some things are objects that you wouldn't expect to be.
May 6, 2016
by Dave Bush
· 7,540 Views · 4 Likes
article thumbnail
Understanding the Java Garbage Collection Log
To diagnose any memory problems, the Garbage Collection log file is the best place to start. Take a look at the anatomy of a GC log file in this helpful article.
Updated May 5, 2016
by Ram Lakshmanan DZone Core CORE
· 200,406 Views · 39 Likes
article thumbnail
Java 8: Lambda Functions—Usage and Examples
One of the major new language features in Java 8 is the lambda function. In fact, it is one of the biggest changes since the Java 1 release. Take a look at this introduction to Java 8's lambda function.
May 4, 2016
by Hari Kiran G
· 217,185 Views · 10 Likes
article thumbnail
Anemic vs. Rich Domain Objects—Finding the Balance
Are you pro-Anemic Domain Model or pro-Rich Domain Object? This article looks at both and seeks to find a balance between the two approaches.
May 3, 2016
by Mahlatse Makalancheche
· 39,743 Views · 22 Likes
article thumbnail
In Oracle SQL, Should You Use CASE, DECODE, or COALESCE?
The Oracle functions CASE, DECODE, and COALESCE all perform similar functionality. They can transform a value into another value. Which one should you use? I'll explain the pros and cons of each in this article.
May 3, 2016
by Ben Brumm
· 235,916 Views · 3 Likes
article thumbnail
A Polyglot's Guide to Multiple Dispatch, Part 2: Python
Part 2 of this Multiple Dispatch series focuses on implementing multiple dispatch in Python.
May 3, 2016
by Eli Bendersky
· 6,232 Views · 1 Like
article thumbnail
Spring Annotation Processing: How It Works
If you see an annotation, there must be some code somewhere to process it.
May 2, 2016
by Alan Hohn
· 64,419 Views · 13 Likes
article thumbnail
Closure-based State in F#
How to use F# to store state in object or class fields.
April 29, 2016
by Ted Neward
· 12,475 Views · 3 Likes
article thumbnail
Service Discovery for NGINX Plus with ZooKeeper
Learn how to use services registered with Apache Zookeeper to issue API calls correctly.
April 28, 2016
by Patrick Nommensen
· 6,020 Views · 4 Likes
article thumbnail
Testing Java EE (or Why Integration Tests Are Overrated)
Testing that goes beyond just unit testing and integration testing. Why we should be doing full system testing.
April 27, 2016
by Sebastian Daschner
· 26,262 Views · 7 Likes
article thumbnail
Mocking Method with Wildcard Generic Return Type
[Ivan Zerin provides a primer on mocking methods that contain generic return types.] There are several cases where construction when().thenReturn is not suitable during Unit tests. One of then generic return type. I have faced such issue, let's take a look. There is a method in interface declaration: public interface FooInterface { public Iterable getList(); ... } Implementation looks like this: public class Foo implements FooInterface { public List getList() { ... } ... } At first mocking of such method should not be something unusual: public class UnitTest { @Mock private FooInterface mockFoo; @Test public void someUnitTest() { ... List testList = generateTestList(); when(mockFoo.getList()) .thenReturn(testList); } } But this code won't compile with error: Cannot resolve method 'thenReturn(List). Seems to be some mistake, cause returned type are correct from the interface point of view. This error happening cause compiler can not gurantee that returned type of method getList() will be List. Actually return type of method getList() in this case is Iterable and this means "Return some Iterable object with any objects that extends SomeClass". Let's rename this type as 'X'. So when(mockFoo.getList()) will create object OngoingStubbing> and it has method thenReturn(Iterable). Compiler can not tell what type X before runtime and cannot perform safe cast from List to Iterable (we perfrom actuall call of method thenReturn(List)). Sounds a little tricky but let's assume that SomeClass is standard Java class Number. Then classes Integer and Double are both fulfill the criteria of List. Let's say that as return type of mock we will use List, in this case, compiler should be ready that actual work with code during runtime will be performed with List too, but it is clearly that cast from Double to Integer will be incorrect (try to cast double value 12.6 to int). You could argue that in the case of mockito compiler won't need to bother about the casting of returned type because call of original method would not produce anything, but it is known by mockito. From compiler point of view, it is only Java code, that should be checked for safety and correctness before compiling. Ok, so how we should deal with such cases in mockito? Use doReturn() method: doReturn(testList).when(mockFoo).getList(); Such expression is not type safe, so it were designed for exceprional cases, so use it only when you cannot use standart when().thenReturn(), which is the type-safe, elegant and more readable syntax.
April 27, 2016
by Ivan Zerin
· 44,668 Views · 4 Likes
article thumbnail
Top 10 CSS Bad Practices
CSS is essential for web development; however, it's difficult to get right for your average developer, who may have interests elsewhere in the stack. Read this article to avoid needling inconsistencies and adopt best practices.
April 27, 2016
by Jonathan Danylko
· 10,319 Views · 11 Likes
  • Previous
  • ...
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×