- Stub: Programmed (by the test automater) to respond to calls made during the test (and only the calls used for the test). Test Stub returns pre-defined values (inputs, with expected outputs). Used to test indirect inputs.
- Mock Object: Represent test doubles used to test the outputs (in an indirect way). A mock object is designed to expect certain calls from the system under test, failing which the mock object throws an exception (thus failing the test). In other words, mocks are used as indirect way to test the outputs of the system under test.
- Dummy Parameter: A dummy (or placeholder) is used to fill parameter lists and are not used anywhere else.
- Fake Object: Fake objects provide the same functionality as the real object, but uses "shortcuts" to obtain the results. Fake objects are only used to speed up testing and avoid probable side-effects.
Friday, April 28, 2006
Fake Dummy Mocks Stubs
Gerard Meszaros has come up with a new name for the mocks, fakes etc. - objects that are used in the place of actual objects while testing. In his soon to come book titled XUnit Test Patterns, he proposes a new name - Test Doubles for all these objects. While Test Double covers the general set of objects used to represent a real time object during testing, there are four different types of Test Doubles vis-a-vis:
Tuesday, April 25, 2006
Code quality for software architects
In the latest installment of In pursuit of code quality, Andrew Glover discusses the quality aspects that affect the long-term viability of a software architecture. Various coupling metrics that help the architect to analyze and support the software architecture in the long run are discussed. Coupling metrics represent the higher aspects of code such as code dependencies, stability and abstractness. The coupling metrics discussed in this article are:
- Afferent Coupling: An integer metric which represents the number of components that are dependent on this object. In other words, it denotes the object's responsibility. Generally, core frameworks (struts), logging packages etc. can have high afferent coupling. It is good to know afferent coupling because changing packages such has struts etc. drastically can cause ripple effects throughout its dependent packages.
- Abstractness: Is the ratio of abstract to concrete classes. It is always easier to change components with higher abstractness without causing too much ripple effect. If the abstractness of a component is low and the afferent coupling high, there is a chance of software entropy (too many interdependencies).
- Efferent Coupling: The number of components that a particular component depends on (inverse of afferent coupling). High efferent coupling, combined with high afferent coupling and low abstractness will pose a huge challenge for the long term viability of a software architecture.
- Instability: It is the ratio of the efferent coupling to the sum of afferent and efferent coupling (Ce /(Ca + Ce)). If this ratio is closer to 0 for a component, the component may be considered stable, since, the more a component is relied on, the less likely it is to change. On the other hand, if the ratio is closer to 1 (afferent coupling = 0) then, any dependency change will affect this component and hence it is more unstable.
- Distance from the main: If you plot Abstractness along the Y-axis and Instability along the X-axis, then the main sequence is a line on the cartesian coordinates X=0 and Y=1 to X=1 and Y=0 (neither of them can be greater than 1). The distance from this main sequence represents the level of balance in the system. This can help you understand how a specific change may affect the maintainability of your architecture.
EHCache 1.2 released
EHCache 1.2 has been released. The 1.2 release of ehcache has many new features like support for distributed caching, new cache update policies (FIFO and LFU), having multiple cahce managers in a single machine etc. The full list of features available in ehcache 1.2 are :
- Flexible, extensible, high performance distributed caching. The default implementation supports cache discovery via multicast or manual configuration. Updates are delivered either asynchronously or synchronously via custom RMI connections. Additional discovery or delivery schemes can be plugged in by third parties.
- New FIFO and LFU caching policies in addition to the standard LRU.
- Introduced CacheManagerEventListener and CacheEventListener interfaces and default implementations.
- Multiple CacheManagers per virtual machine.
- Programmatic flushing of application state to persistent caches
- Significant (up to 7 fold) DiskStore performance increases.
- API for Objects in addition to Serializable. Non-serializable Objects can use all parts of ehcache except for DiskStore and replication. Two new methods on Element: getObjectValue and getKeyValue are the only API differences between the Serializable and Object APIs.
- Backward Compatibility with ehcache-1.1. All users of ehcache-1.1 should be able to upgrade to ehcache-1.2.
- Tested with Hibernate2.1.8 and Hibernate3.1.3, which can utilise all of the new features except for Object API and multiple session factories each using a different ehcache CacheManager. A new net.sf.ehcache.hibernate.EhCacheProvider makes those additional features available to Hibernate-3.1.3. A version of the new provider should make it into the Hibernate3.2 release.
- Tested with ehcache-constructs.
- Apache 2.0 license.
Thursday, April 20, 2006
StarUML: Open source modeling tool
The lack of a RSA at my new job led me to search for a free modeling tool. That is how I stumbled upon StarUML. StarUML is an open source modeling tool for the Windows platform. It is sponsored by Plastic Software which is a member of OMG. StarUML comes with support for UML 2.0 and MDA (Model driven architecture). Plugins for StarUML may be written any COM compatible language. Plugins for code generation and reverse engineering applications for common programming languages (Java, C++, C# etc.) are already available. The following is a list of features available in the current release of StarUML:
- Accurate UML Standard Model: Strictly adheres to UML standard.
- Open Software model format: All files are managed in standard XML format.
- MDA Support
- Applicability of methodologies and platforms: Support for application framework models like .NET and Java Enterprise Edition.
- Excellent Extensibility: All functions are extensible through plugins which can be written in any COM compatible language.
- Software model verification function: Automatic verification of models, facilitating eary discovery of errors.
- Useful Add-Ins: Includes many useful add-ins. Generates code for most common programming languages, and also generates models from code.
Wednesday, April 19, 2006
AjaxTags for Java Server Pages
AjaxTags is a JSP tag library that provides a set of tags for Java EE developers to create Ajax-enabled web forms. AjaxTags depends on Javascript-based Prototype framework, and the scriptaculous library, it also depends on the DHTML-based OverLIBMWS library. All you have do to create an Ajax-enabled Web form is to include the library in your classpath, define the tld in web.xml and include the required Javascript core in your JSP. An additional event handler (a Java servlet) has to be written to handle the client events. The following is a list of tags provided in the current release (1.2):
- Autocomplete Retrieves a list of values that matches the string entered in a text form field as the user types.
- Callout Displays a callout or popup balloon, anchored to an HTML element with an onclick event.
- HTML Content Replace Builds the JavaScript required to hook a content area (e.g., DIV tag) to a link, image, or other HTML element's onclick event.
- Portlet Portlet-style capability from a AJAX-enabled JSP tag.
- Select/dropdown Based on a selection within a dropdown field, a second select field will be populated.
- Tab Panel Enable an AJAX-based set of property pages.
- Toggle Uses images to create either a single on/off toggle or a sequential rating system.
- Update Field Updates one or more form field values based on response to text entered in another field.
- Area and Anchor Shows how to AJAX-enable any area of your page.
- Ajax DisplayTag Shows how to AJAX-enable DisplayTag
Friday, April 14, 2006
Open Architecture Framework (TOGAF)
The Open Group Architecture Format (TOGAF) is an industry standard architecture framework build an information systems architecture. It is divided into three parts:
- Architecture Development Method (ADM): It is the core of TOGAF. Describes a step-by-step approach to developing an enterprise architecture.
- Enterprise Continuum: A virtual repository of architecture assets, i.e. the TOGAF foundation architecture, and the Integrated Information Infrastructure.
- Resources: Comprises of the TOGAF Resource Base - a set of tools and techniques available for use in applying TOGAF and the TOGAF ADM.
Friday, April 07, 2006
DB2 Viper
DB2 Viper is the code name for the next release of DB2. DB2 Viper can handle both relational and XML data. In what it terms as "native XML", the XML data is stored in a parsed heirarchical format rather than requiring it to be transformed into row and column format or store it as a large object. The new storage structure will enable you to query the database using XQuery or SQL. You can download the beta version on the DB2 Viper download site. The administrators can use standard SQL data definition language statements to create database objects to store relational and XML data, and this can be done in a single statement. For example, to create a table with an XML column, you can make the query as follows:
Since the XML data is self-describing, you don't have to give additional information with it. It will be accepted as long as it is well-formed. You can also create an XML index to speedup your searches of the XML data. This requires the index key to defined using an "xmlpattern", which is an XPath expresssion (no predicates, ofcourse) to identify the subset of the XML document. You will also have to specify the SQL datatype represented by the subset selected by the XPath expression. For example:
create table case (
caseNumber varchar(10)
primary key not null,
status varchar(10),
schedule varchar(30),
county varchar(10),
arraignmentNotice xml
)
The following is a list of the features provided with DB2 Viper
create index caseIndex on case(arraignmentNotice)
generate key using xmlpattern '/arraignmentNotice/date'
as sql DATE
- Efficient storage techniques for managing XML data in hierarchical format.
- Support for indexing XML data
- Support for XQuery as well as SQL (with XML extensions) to query XML data
- Support for validating XML data using schemas
- API support for popular languages like Java, C, COBOL and .NET platform
- An Eclipse based developer's workbench which includes a graphical XQuery builder.
- DB2 Viper Site
- Query DB2 XML Data with SQL
- What's new in DB2 Viper
- XQuery from the Experts: Influences on the design of XQuery
- An introduction to XQuery
- Native XML Support in DB2 Universal Database [PDF]
Subscribe to:
Posts (Atom)
Popular Posts
-
This post will describe how to create and deploy a Java Web Application war to Heroku using Heroku CLI. You will need a basic understanding ...
-
The previous post described how to implement a JMS messaging client using Spring JMS . This post will describe how to implement the Message ...
-
Last week, I described how to implement JMS, using a stand-alone client and a Message Driven Bean . In this post and the next, I will descr...
-
In the previous post, I described the use of Displaytag to implement paging in a simple JSP. In this example, I describe the use of Displayt...
-
In this post we will see how to do an offline install Jenkins and required plugins on a Red Hat Enterprise Linux Server release 7.3. This is...
-
In a previous post, I described how to use Quartz scheduler for scheduling . In this post, I describe the configuration changes required for...
-
New posts with iText 5.5.12 Following are two new posts for PDF Merge with iText 5.5.12 Merge PDF files using iText 5 Merge and Paginate PDF...
-
From Websphere Information Center. http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1/index.jsp?topic=/com.ibm.wasee.doc/info/welcome_ee....
-
Acegi Security provides a comprehensive security solution for J2EE-based enterprise software applications, built using the Spring Framework...
-
The previous post described how to setup a Queue in Weblogic Server . This post shows the code necessary to run a Simple Messaging example u...