
The Scala Programming Language Testing Private Methods with JUnit and SuiteRunner Testing Private Methods with JUnit and SuiteRunnerby Bill VennersMay 24, 2004 Page 1 of 3 >> Summary This article compares four different approaches to testing private methods in Java classes. My very first use of JUnit was to build a conformance test kit for the ServiceUI API [1]. The purpose of a conformance test kit is to help ensure that alternate implementations of the same API are compatible with the API's specification. When I later applied JUnit to the task of writing actual unit tests, as opposed to conformance tests, I found myself wanting to write white box tests—tests that employ knowledge of the internal implementation of the packages and classes under test. Daniel Steinberg [2] showed me the common JUnit technique of using parallel source code trees, which allowed me to place test classes in the same package as the classes under test, but keep them in a different directory. Don't test private methods.
dzone.com - fresh links for developers Lift Web Framework Java Bien! ACCU Lift Web Framework: Demo Dusty's Diverse Domain Welcome to the final part of this series on creating a working Jabber client in Kivy. While there are numerous things we could do with our code to take it to Orkiv version 2, I think it’s currently in a lovely state that we can call “finished” for 1.0. In this article, we’re going to talk about releasing and distributing Kivy to an Android mobile device. We’ll use a tool called buildozer that the Kivy developers have written. These commands will, in the future, extend to other operating systems. We aren’t going to be writing a lot of code in this part (some adaptation to make it run on android is expected). Remember to create and activate a virtualenv populated with the appropriate dependencies, as discussed in part 1. Table Of Contents Here are links to all the articles in this tutorial series: Restructuring the directory Back in Part 1, we chose to put all our code in __main__.py so that we could run it from a zip file or directly from the directory. I’m not overly happy about this.
The C++ Source In this article, Scott Meyers describes a technique that enables the specification of arbitrary combinations of user-defined code features on a per-function basis and that detects violations of feature constraints during compilation. by Howard E. Hinnant, Bjarne Stroustrup, and Bronek Kozicki, March 10, 2008, 62 comments Rvalue references is a small technical extension to the C++ language. Rvalue references allow programmers to avoid logically unnecessary copying and to provide perfect forwarding functions. Computers make life easier because they're so fast, right? The author discusses how the use of generic programming in C++ can lead to conflicts with object-oriented design principles. C++ is a language for writing efficient high-performance programs, and bit manipulations are bread and butter of many such programs. Have your cake and eat it, too, with STL extensions. Object factories provide a useful abstraction for object construction. by Anand Shankar Krishnamoorthi, July 11, 2007,
Eventually Coding C++ FQA Lite: Defective C++ Part of C++ FQA Lite This page summarizes the major defects of the C++ programming language (listing all minor quirks would take eternity). To be fair, some of the items by themselves could be design choices, not bugs. For example, a programming language doesn't have to provide garbage collection. It's the combination of the things that makes them all problematic. For example, the lack of garbage collection makes C++ exceptions and operator overloading inherently defective. No compile time encapsulation In naturally written C++ code, changing the private members of a class requires recompilation of the code using the class. This makes C++ interfaces very unstable - a change invisible at the interface level still requires to rebuild the calling code, which can be very problematic when that code is not controlled by whoever makes the change. Well, at least when all relevant code is controlled by the same team of people, the only problem is the frequent rebuilds of large parts of it.
Sylvain Zimmer | Blog Two weeks ago, while waiting for my flight to San Francisco at an airport in Paris I stumbled on a coding challenge by NASA to optimize the solar arrays of the International Space Station. I’ll let the video explain: Being very interested in Optimization for my soon-to-be-unveiled new startup, I was quite excited and promptly downloaded all the required material to spend my 10-hour flight hacking ;-) The rules forbid talking about code while the contest is running but since it just finished, I would like to share how I built my solution with tools like OpenOpt, EC2 Spot Instances and MongoDB. Disclaimer: Shortly after landing I was the top Python solution and 10th overall but I couldn’t spend enough time on my code while abroad to stay that high in the charts. The contest TopCoder made a Java simulator available along with the detailed description of the problem. So the whole contest was basically about minimizing the shadows cast by the front solar arrays and the station itself.
Terra Informatica » Generators in C++ May 26, 2008 As we know iterators in C++ is a good but not perfect abstraction. Concept of foreach() (D, Python, Ruby, etc.) appears as more generic solution. At least foreach() does not require artificial iterator::end() to be defined for the collection. Abstraction foreach() can be imagined as some function/object that is returning next value of collection/sequence each time it is getting invoked. Such functions are known as generators. Here is my version of generator() for the C++. First of all sample, here is a declaration of our generator function in C++: #include "generator.h" generator(descent) { int i; emit(int) // will emit int values. Having declared such generator we can use it as: int main(int argc, char* argv[]) { descent gen; do printf("next number is %d\n", gen()); while (gen); return 0; } That is pretty simple and should be intuitively clear, no? Here is full source of the generator.h file: Enjoy!