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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Languages Topics

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,286 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,706 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,270 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,454 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,125 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
· 216,928 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,615 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,670 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,139 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,294 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,426 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
· 5,916 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,135 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,516 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,233 Views · 11 Likes
article thumbnail
Logback Configuration: Using Groovy
Logback is one of the most popular logging frameworks for Java, but did you know you could configure it using Groovy? This guide walks you through the whole process.
April 27, 2016
by John Thompson
· 26,453 Views · 7 Likes
article thumbnail
Collaborators and Libraries: Java Design Patterns for Success
Should constructors throw exceptions? What can the 1815 Congress of Vienna teach us about good Java design?
April 26, 2016
by Alan Hohn
· 10,723 Views · 7 Likes
article thumbnail
Sorted Pagination in Cassandra
We have a look at how to implement sorted pagination with the popular NoSQL solution Cassandra.
April 26, 2016
by Felipe Fernández
· 13,787 Views · 5 Likes
article thumbnail
Build a REST API with XML Payload
Creating REST APIs with XML payloads.
April 23, 2016
by Neerav Aggarwal
· 49,676 Views · 3 Likes
article thumbnail
Java 8 New Date And Time Overview
A practical introduction to the new and improved Date & Time API in Java 8. If you've not had chance to review or use it yet then start here!
April 22, 2016
by Siva Prasad Rao Janapati
· 14,908 Views · 5 Likes
  • Previous
  • ...
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • ...
  • 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
×