Showing posts with label Software-Development. Show all posts
Showing posts with label Software-Development. Show all posts

Wednesday, October 5, 2011

Modern Web Development API / JSON


JSON

-------------------------------------------------------------------------------------------------------------------

Understanding JSON: the 3 minute lesson

    And what does that mean? JSON is a syntax for passing around objects that contain name/value pairs, arrays and other objects
    
tutorial :
 Converting a JSON Text to a JavaScript Object
  One of the most common use of JSON is to fetch JSON data from a web server (as a file or as an HttpRequest), convert the JSON data to a JavaScript object, and then use the data in a web page.
For simplicity, this can be demonstrated by using a string as input (instead of a file).
 http://www.w3schools.com/json/json_eval.asp 
  http://www.w3schools.com/json/tryit.asp?filename=tryjson_eval  ( try example )

http://www.w3schools.com/json/tryit.asp?filename=tryjson_create




REST web Services
----------------------


http://www.webmonkey.com/2010/02/get_started_with_rest/  -- what is REST easy one ... ( see examples at bottom )
http://www.xfront.com/REST-Web-Services.html
http://rest.elkstein.org/
http://www.myeclipseide.com/documentation/quickstarts/webservices_rest/   - OLD way


Web APIs:

-------------------------------------------------------------------------------------------------------------------



4,000 Web APIs: What’s Hot and What’s Next?

asr: 1/ Modern and popular WEB APIs are using  'REST' protocol and in the response giving either JSON or XML .
 2/  It seems when you start any Development , you have to start with  Web API first , after looking at these 4000 APIs .. no more hard coding the Server Calls in the 'Client code' .  In your own client code also JUST call  WEB APIs .. so you are API  from BIRTH ... not After thought .

http://blog.programmableweb.com/2011/10/03/4000-web-apis-whats-hot-and-whats-next/


Most Popular APIs( based on #of Mashables): http://www.programmableweb.com/apis/directory/1?sort=mashups
Breaking Down E-Commerce APIs: http://blog.programmableweb.com/2011/09/09/breaking-down-e-commerce-apis/
API Score CARD:  http://www.programmableweb.com/scorecard
8 Different FaceBook APIs: http://www.programmableweb.com/apis/directory/1?company=Facebook
91 Google APIs: http://www.programmableweb.com/apis/directory/1?company=Google

API growth Time Line Monthly from 2007:  http://blog.programmableweb.com/2011/09/16/open-api-growth-a-visualization/



Monday, October 3, 2011

Mobile Web App vs. Native App? It's Complicated

 Show where ' Native vs.  Web  '  mobile apps  people are using in 2011



complete Resarch Paper Here:  good one :  http://www.google.com/url?sa=t&source=web&cd=2&sqi=2&ved=0CDQQFjAB&url=http%3A%2F%2Fl.yimg.com%2Fa%2Fi%2Fus%2Fayc%2Fpdf%2Fmobile_modes_whitepaper.pdf&rct=j&q=mobile%20modes%20how%20to%20connect%20with%20mobile%20consumers&ei=PCiKTpneHue0sQL6xP2nDw&usg=AFQjCNG-N85EMyqQrdFh77DtNljuSQkjLw&sig2=4Xl9DZ8-RxhekruK4Llkqg&cad=rja

source: 


overview:
http://www.forbes.com/sites/fredcavazza/2011/09/27/mobile-web-app-vs-native-app-its-complicated/

good presentation deck:
http://www.worklight.com/resources/webinars-and-tools/native-web-hybrid-mobile-app-development

Hybrid apps, which rely on development frameworks like SenchaPhoneGap,TitaniumRhomobileParticleCodeMosyncBkRender… These mobile apps offer a very interesting compromise because they ensure cross-platform compatibility and can access the phone’s hardware (camera, GPS, user’s contacts).


compare diff. frame works.
http://stackoverflow.com/questions/1482586/comparison-between-corona-phonegap-titanium

asr: a/ Sencha is well funded , seems catching up in the enterprise based on their big client list
  b/  Adobe just bought  Nitobi  the 'PhoneGap' creator  
  c/  seem these 2 flatforms are catching up.
  d/  do not forget this one coming   http://jquerymobile.com/ 
   http://jquerymobile.com/test/docs/lists/lists-search-with-dividers.html   -- great JQuery UI examples
    http://jquerymobile.com/test/   -- Drill all from here -- good ones
   http://mobile.tutsplus.com/tutorials/mobile-web-apps/jquery-mobile-forms/  -- JQuery Tutorial good one
   http://www.mobosurvey.com/survey/designer   -- good simple Editor .....

http://www.phonegap.com/  http://www.nitobi.com/products/phonegap/
http://www.phonegap.com/tools  -- tools

http://www.sencha.com/products/touch/
http://dev.sencha.com/deploy/touch-charts-1.0.0/examples/   -- touch charts are good , it is $99
http://www.sencha.com/  - complete


http://www.nitobi.com/casestudies/schenker/   -- data packed screen they developed, good UI ...

http://developer.sonyericsson.com/wportal/devworld/article/developerresourcesmobileinterface?cc=gb&lc=en

Monday, November 30, 2009

eapps

Pear and Pecl Support

Applicable Plans: All Standard VPS, all Advanced VPS, all Premier VPS, Plesk Gold VPS, Plesk Platinum VPS Plans

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

Requirements

PHP must be installed in your VPS subscription. This can be done by selecting it when you order the eApps VPS hosting service or by installing it using the Control Panel after the service has been provisioned. To see if PHP is already installed login to your Control Panel and click on the All Applications icon. If it is not in the installed list, you may install it by clicking on the Add Application icon from the System tab and selecting PHP then clicking Next.

General Information

Your eApps PHP has all of the features to allow you to develop a site using the latest standards and modules. Below is a list of all the features installed by default.
--------
Your PHP by default has both pear and pecl enabled so you can install any modules directly from the php.net site. To use pear or pecl you will need to login to SSH as root. Please read the SSH user guide for more details -http://support.eapps.com/hsp/ssh.

Execute the below commands for installing modules.

pear install module_name

Or

pecl install module_name


Once your module is installed it needs to be loaded in PHP in order to be available for use. To load it you will need to create a file in /etc/php.d/ called module_name.ini that should contain:

extension = module_name.so

It is preferrable to use a new file for each extension you want to load. This allows for easier management of extensions php is using. Certain modules have their own list of variables that can be defined. You should also define them in the extension file instead of directly using php.ini. The file php.ini should be used only to define php default values, and not to load extensions. Please refer to the section below, called 'Editing the php.ini file' for more details about php.ini file.

After the file was added, you will need to restart Apache web server. You can either restart it from the control panel -> system tab -> apache web server -> restart or by SSH. Please note that you need to be the root user to be able to restart Apache with this command:

service httpd restart

-----------
Why use an eApps Virtual Private Server for your PHP hosting needs?
We understand that the reason you are looking for a VPS hosting service is because you are frustrated by the limitations of shared hosting and standard issue VPS services with an inferior PHP environment. With your needs in mind, we are offering PHP for power users. Our PHP is the latest version available from the php.net site, and it comes with rich features, including the following:

* pear and pecl pre-installed, ready for use
----------------------------------

Reading and Writing Spreadsheets with PHP

Breaking The Language Barrier

downloaded from this link and unzipped , it works, no install of pkg. reqd.
a) just rename oleread.inc to oleread.php
b) require_once 'Excel/oleread.php'; -- change in reader.php file
c) given jvx* xls file is bad, so use your own .xsl
d) with all 3 above it works. ..

http://sourceforge.net/projects/phpexcelreader/files/

When it comes to playing nice with data in different formats, PHP's pedigree is hard to beat. Not only does the language make it a breeze to deal with SQL resultsets and XML files, but it comes with extensions to deal with formats as diverse as Ogg/Vorbis audio files, ZIP archives and EXIF headers. So it should come as no surprise that PHP can also read and write Microsoft Excel spreadsheets, albeit with a little help from PEAR.

In this article, I'll introduce you to two packages that make it surprisingly easy to hook your PHP scripts up to a Microsoft Excel spreadsheet and extract the data contained therein. I'll also show you how to dynamically create a new spreadsheet from scratch, complete with formulae and formatting, and import data from a spreadsheet into a database. So come on it, and let's get started!

I should mention at this point certain changes you might need to make to your development environment in order to get the PHP-ExcelReader package working. As noted above, this package is currently not maintained and so, simply include()-ing the main class file, 'reader.php', in your script, as suggested in the package documentation, is insufficient and generates a 'missing file' error.

To get things working, extract the file 'oleread.inc' from the distribution archive and save it to a location in your PHP include path using the directory structure 'Spreadsheet/Excel/Reader/OLERead.php'.
-----------

Here's an example how to read these files

http://forums.codewalkers.com/pear-packages-47/spreadsheet-excel-reader-852965.html

Saturday, November 1, 2008

Zend Framework

Some Zend Framework statistics of interest.

Latest Web Development Features
* AJAX support through JSON – meet the ease-of-use requirements your users have come to expect
* Search – a native PHP edition of the industry-standard Lucene search engine
* Syndication – the data formats & easy access to them your Web 2.0 applications need
* Web Services – Zend Framework aims to be the premier place to consume & publish web services
* High-quality, object-oriented PHP 5 class library – attention to best practices like design patterns, unit testing, & loose coupling


Authentication, Authorization, and Session management
* Zend_Acl
* Zend_Authentication
* Zend_Session

Virtually all web applications have some user-specific data that must be customized, and usually, protected from access by other users. Accomplish this quickly and easily with the above features of Zend Framework.

-----
Mail, Formats, and Search

* Zend_Json, Zend_Pdf
* Zend_Mail, Zend_Mime
* Zend_Search_Lucene

Web 2.0 applications require support for Ajax, PDF generation, e-mail communication, and search, all an increasingly important part of web applications today. Zend Framework simplifies a developers life and gives you built-in support for these essential, if not critical, features for your application.

-------
Model-View-Controller (MVC)

* Zend_Controller, Zend_Controller_Action, Zend_Controller_Dispatcher, Zend_Controller_Plugin, Zend_Controller_RewriteRouter, Zend_View
* Zend_Http_Request, Zend_Http_Response

The above components make use of the industry standard web application design pattern MVC

7 reasons I switched back to PHP after 2 years on Rails

September 22, 2007 5:49PM -by Derek Sivers in Opinion


SUMMARY: I spent two years trying to make Rails do something it wasn’t meant to do, then realized my old abandoned language (PHP, in my case) would do just fine if approached with my new Rails-gained wisdom.
----------
asr: see user comments .. lot to learn from it

Part 2:
I would never, ever, have used ruby on rails for an enterprise app. Why? Well first, try Googling tutorials on how to do something with a Ruby library (ex. Rant) . What do you find? Next to nothing (and this website for whatever it is worth). Try a Google search for MS.Build or SOAP clients in C#. 1 gazillion results, some pro, some not. Ruby is a teenager, smart, rebellious, inexperienced, but will probably grow up to be a good citizen one day. There is fun code and there is give me money to buy food code. For the latter, I will use C# or Java,

Andy
Also, it's really easy in Rails to create APIs on top of existing database tables and Rails is best mates with SQL - it's just as easy to use SQL in Rails as in PHP.

Leandro | October 9, 2007 01:43 PM
------------
So what ure saying is that you never needed rails nor had the will to go that way, but you didit anyway, and what is even worse, you say you tried to turn a train into a boat, when what you actually did was putting a train in the sea and yelled at it to make it float.

#1 - “IS THERE ANYTHING RAILS/RUBY CAN DO THAT PHP CAN’T DO? … (thinking)… NO.” thats not even a reason to go for ruby or php. thigns are different in both of them.

#2 - OUR ENTIRE COMPANY’S STUFF WAS IN PHP: DON’T UNDERESTIMATE INTEGRATION
This is a great reason to have never tried rails. 2 years is a long time to learn that.

#3 - DON’T WANT WHAT I DON’T NEED
tatoo that on your forehead so you remember that after the first setback.

#4 - IT’S SMALL AND FAST
i dont know that as a fact and dont

#5 - IT’S BUILT TO MY TASTES
2 years late on that one too

#6 - I LOVE SQL
you must have missed it alot.

#7 - PROGRAMMING LANGUAGES ARE LIKE GIRLFRIENDS: THE NEW ONE IS BETTER BECAUSE *YOU* ARE BETTER
you cheated on your wife with a 20 yr old girl, and after 2 years finally accepted you cant put up with her lifestyle.

Im sorry if its too direct and migth even sound aggressive, but 2 years programming with the php paradigm over rails api sounds like a huge mistake.

---------
Bob
SQL allows you to let the database do the work. But as far as alot of RAILS or other ORM users are concerned, pulling back rows from individual tables and "joining" them in memory in a very inefficient way is somehow beneficial. Because they dont know how to leverage existing technology.

Monday, April 14, 2008

10x Software Development

Numerous studies have found 10:1 differences in productivity and quality among individuals and even among teams. This blog contains Steve McConnell's thoughts about how to move toward the "10" side of that 10:1 ratio.

Technical Debt


Code Complete: A Practical Handbook of Software Construction (Paperback) - June 2004 2 nd edition - great reviews ..

Thursday, April 10, 2008

TRAC - Software project management and bug/issue tracking system

Welcome to the Trac open source project. It is Integrated SCM & Project Management tool ( Software Configuration Management SCM )

Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission is to help developers write great software while staying out of the way. Trac should impose as little as possible on a team's established development process and policies.

It provides an interface to Subversion, an integrated Wiki and convenient reporting facilities.

Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all project events in order, making the acquisition of an overview of the project and tracking progress very easy.

asr Note: what I like
1/ easy user privillege grant , delete
2/ SubVersion code browsing
3/ built-in wiki
3/ dynamic Filter add/delete while views bugs - this should be the feature that can be implemented in any query based system ( even with Flex system )

SubVersion
The goal of the Subversion project is to build a version control system that is a compelling replacement for CVS in the open source community.
SubVersion growth
- Commits are truly atomic.:No part of a commit takes effect until the entire commit has succeeded. Revision numbers are per-commit, not per-file.
- asr note: If Auct gaint has this atomic commits along with pulling a snapshot just with one user check-in at a time (making other wait for a minute and inform with a Chat session when second user gets turn ) . Then it can build just for that user changes on a server . This way every checkin will have it's own build , it may look expensive but compared to build failure cost ( detect , inform developer and fix 3 hours $600 cost ) having 5 servers with virtuvalization doing this job not costly


login with Demo / Demo

Spring team uses TRAC , check these pages:
- this layout of white and green links looks good, try to use this layout get reqd css etc..
- at the bottom of page you have edit button, you can try to change any page to see How easy is Wiki..
- TitleIndex
- see this Wiki page , when you click on the Table of Contents at the top right it shows nice edit for TOC

Trac hosting services

Ruby Rails project using TRAC code diff:
http://dev.rubyonrails.org/changeset?new=adapters%2Finformix%2Flib%2Factive_record%2Fconnection_adapters%2Finformix_adapter.rb%408320&old=adapters%2Finformix%2Flib%2Factive_record%2Fconnection_adapters%2Finformix_adapter.rb%407982
- New Bug Ticket

HTML template system - Clearsilver

Clearsilver is a fast, powerful, and language-neutral HTML template system .
In both static content sites and dynamic HTML applications, it provides a separation between presentation code and application logic which makes working with your project easier.

Who is using it:Here are some examples of websites and applications built today using ClearSilver. The host programming language is also listed .

Clearsilver Compared: vs. PHP, ASP, JSP

How does Clearsilver compare with XML/XSLT?

asr Note: 1) Orkut is using it with Java backend. See if any open source project using this with Java to look at code.
2) good software like TRAC is using it , google groups uses it.
3) google hired ClearSilver author after using it in google groups. Auct gaint missed this kind of hiring industry hand-on coding experts and relying on in-house engineers for innovation/next Gen architectures(v4). This authors should have found solution to dynamic content ( for L10n) and java back end data for this Auct huge site. Now hundreds of engineers strugle every day to fix bug/do enhancements by spending twice the requried time ( compared to good designed system likes of ClearSilver )day in day out for years

Wednesday, April 9, 2008

Latest Development Platform



Add to above list the 'MyEclipse' tools work bench( pulse tool )
10x-software-development

Introduction to the UML 2.0
- asr: I personally believe Product Managers ( PMs) should express their PRD in UML 2 diagrams that way any programmer in the life of 5x ( 5 times ) the development of the software can refer to the specifications.

Thursday, April 3, 2008

RIA FLEX SilverLight Adobe AIR

Rich Internet application predictions for 2008

Rich Internet application predictions from the experts

_________________________________________
Who is using FLEX
FLEX customers

Christophe Coenraets - he seems developing good apps with Flex , see good user comments
Live Help / Call Center Application with Flex and BlazeD

Using Flex with Spring

ACCELERATE4PHARMA?

http://labs.adobe.com/showcase/air/salesforce.html


_________________________________________

http://flex.org/

Component Explorer
http://www.adobe.com/support/documentation/en/flex/

Programming ActionScript 3.0
Flex Builder 3

Welcome to BlazeDS! BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe® Flex™ and Adobe AIR™ applications for more responsive rich Internet application (RIA) experiences.


The Adobe® AIR: Browser vs. desktop
The Adobe® AIR™ runtime complements the browser by providing the same application development and deployment benefits while adding desktop integration, local data access, and enhanced branding opportunities. An emerging design pattern for rich Internet applications (RIAs) is to deliver a browser-based version of an RIA in the browser for all users and an RIA on the desktop for more active users.

- This page has examples that covers every thing. -- use these along with Flex Builder 3 IDE download ( stand alone not Eclipse Plug-in )
Adobe AIR Sample Apps
- screens http://www.bhira.net/pages/stockq.php

-----------------------------
- ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers - asr: seems Good ready to use problem solution book .
- Each code recipe presents the Problem, Solution, and Discussion of how you can use it in other ways or personalize it for your own needs, and why it works. You can quickly locate the recipe that most closely matches your situation and get the solution without reading the whole book to understand the underlying code. Solutions progress from short recipes for small problems to more complex scripts for thornier riddles, and the discussions offer a deeper analysis for resolving similar issues in the future, along with possible design choices and ramifications. You'll even learn how to link modular ActionScript pieces together to create rock-solid solutions for Flex 2 and Flash applications.

When you're not sure how ActionScript 3.0 works or howto approach a specific programming dilemma, you can simply pick up the book, flip to the relevant recipe(s), and quickly find the solution you're looking for.



From Java to Flex
- 0. Flex handles all the translation between Java and ActionScript classes.
- 1. The simplest use allows a Java developer to expose Plain Old Java Objects (POJO's) as back-end services via a simple configuration. Objects are transferred to the client in a compact binary format called AMF3 and converted to ActionScript 3.0 classes, which is far more efficient in the transferring and rendering time than other implementations, like XML. Combining Data Services with the popular Java POJO-based frameworks, like Hibernate and Spring, creates a truly powerful combination for building enterprise applications.

- 2. LiveCycle Data Services ES deploys in a Servlet/J2EE container and provides significant server-side infrastructure to Flex applications. Data Services offers a number of features, including remoting, publish/subscribe messaging, and data management (client-server synchronization, paging, notification, Hibernate adapter, etc).

- Tree Map open source component -- look at source code very simple ..
- More Flash Open source project , click on the cloud elements to see details ..
- Flex for Java developers - has 1 hour online demo of app with JAVA & Flex
- You have code for Tree control, list for all programming UI control you need in application WOW
- All our dream Menu controls code is here
- Using action effects in a transition
- About Change transitions see example at bottom nice one
- Fonts in Flex - Flex Support all the CSS files ( see web for it ) , he is the author of Flex TreeMap
- Skinning Flex app , see they have Nice tutorial and app
- Ajax and Flex Data Loading Benchmarks


Rich Internet Applications with Adobe Flex 2 and JavaFlash + POJO = RIAs
- Chapter 4 of the book
anothr stock app with URLs - right mouse to see code ..

An ActionScript 3 class library.These are utility classes for use in any ActionScript 3 development;
- http://almiruncommonlib.riaforge.org/

Flex 2 Samples -- last update 2008/02/15
- go to gridFilter and do view source
--------------------------------

Sunday, March 30, 2008

Java Profiling

Java Application Profiling using TPTP
- By Valentina Popescu, IBM - July 2006

Profiling an Application
In the current environment of short development cycles for delivering a product, developers tend to focus more on the functional aspects of application execution, mostly via testing, debugging, and code fixing. However, many problems do not easily surface until the application is running in production mode, 24 hours a day, 7 days a week and gets pushed to limits during some unexpected peak periods.

The kinds of performance problems encountered in production cannot be discovered during a debugging session. Before deployed and run in production mode, it is important to use a Profiling tool to analyze application execution and identify performance problems, such as execution bottlenecks, object leaks, and system resource limitations.
This article provides an introduction to the TPTP Profiling tool. It demonstrates how to use the TPTP Profiling tool to profile a Java application in order to identify performance hot spots, and fix and validate performance problems.

TPTP Profiling Tool
The Eclipse Test & Performance Tools Platform (TPTP) Project offers a profiling tool for identifying and isolating performance problems such as performance bottlenecks, object leaks and system resource limits. The tool targets applications of all levels of complexity, from simple standalone Java applications to Eclipse plug-ins or complex enterprise applications running on multiple machines and on different platforms.
This article was written using the TPTP 4.2.0 which require Eclipse 3.2.0.

TPTP Selected as the best free Performance tool for 2006

-----------------------------------
TPTP API Recorder and Test Generation Tutorial

asr: using these tools below auction firm can save hundreds of developer hours by saving exceeptions to a common base ( LDAP /DB ) from the log files.

Stand-alone Generic Log Adapter v4.3 User's Guide
Overview of the Generic Log Adapter
The Generic Log Adapter allows you to process application log files and transform their contents into the Common Base Event format
. The Common Base Event specification prescribes a common format for logging, management, problem determination, and autonomic computing. It provides a consistent format that facilitates intercommunication between tools that support these goals. Common Base Event objects allow you to develop a common prescriptive event in a consistent format so that tools can be developed to support these goals.

In order to take advantage of tools such as the Log and Trace Analyzer that support Common Base Event objects, your application log files need to conform to the Common Base Event format. To produce application log records that conform, you can do one of the following:

- Change the application that generates the log file to create Common Base Event records directly.
- Write a transform that converts application log files to Common Base Event records.
The first approach is impractical unless the application is currently being developed. This approach does not solve the problem of integrating existing application logs with the Common Base Event format.

The second approach is more practical. However, it leaves you with the tedious task of writing the transform. Typically, this is accomplished by either writing some custom code in either a third-generation programming language or a script that can be used by established scripting tools such as Perl. Once the transform is created, you must test the transform and integrate the transform solution into the tools that use Common Base Event objects.

Friday, March 28, 2008

Java bycode debuggers

AOP@Work: AOP myths and realities - Beyond hype and misunderstandings - 14 Feb 2006

asr: If we just need to log all method execution trace of business flow along with parmeter values passed for each method , it can be done with Spring frame work with simple xml declarions, pls. check , If this is the only purpose do not need the complex ASM etc..

http://asm.objectweb.org/ - ASM java byte code debugger used by autciton gaint.

ASM package seems specially designed to create method flow of Java server code. It helps programmer to quickly find bug in a complex flow of software.
Next setp is to create method flow diff of 2 different software relaease running on 2 different servers .

- using spring AOP : It is worth to try to create dynamic proxy's for all methods of all classes with loggigng of method entry with all parameter data printed so that a prorgrammer can see what is wrong in a flow. mostly you get different set of data causing null pointer exceptions

Sunday, March 23, 2008

Software Development system for high productivity

Prsentation code:
- Aptana : use this nextGen for all Ajax developemnt and debugging
- for css: ready to use code fom 'css design patterns' book
- you have MyEclipse for JSP , JSF development

Server code:
- Spring framework with Webflow , Jdbctempales, aspects for (logging and debug mode code to log 'method level flow traverse code' )
- use Spring in action book code samples , and good articles on javaworld.com javalobby.com , serverside.com
- you have pulse for automatic Eclipse download and config of plug-ins.
- you have MyEclipse with all these plug-ins no hassle install and run , you have pulse for profile and use it at home/office .

Testing :
- testNG see TestNG crator book , TDD approach , use watij ( web application testing in Java ) to comibine with TestNG to create all functinoal test cases. Automate it to run for each bugfix/change

Thursday, March 20, 2008

software testing issues and solutions

-----------
WatiJ vs. HttpUnit vs. Selenium
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=68&t=001476
- post said use HtmlUnit instead of HttpInput as first is latest project
-----------------------------------------
High level software testing automation components
1. Test data beds
2. capture html pages at server end point before returning to browser
3. capture what user entered ( data or clicks )
4. save .htm files in step 2 and step 3 to server so that 'tester/bug fix developer' can see 'total flow ' as set of html screens saved on a server. just click on links like pag1 , page2 it shows each page in the flow . It should be that simple .
5. server logging of all method flow along with ( values passed ) is also saved .
6. all web pages will have hidden field like <input type="hidden" name="flowStatus" value ="fromflow:REIInput;toflow=ERR_REQIRED_FIRSTNAME;desination=RegSuccess">. WatiJ java code will process this hidden filed after every web GET/POST and compare with expecgted codes and mark the test case as either faiure or success. In WatiJ we write this code
read whole data input into java object
document.firstName = inputObj.getFristName(); // then assingn to watiJ values ..
document.lastName = inputObj.getLastName() ;
document.firstName = hash1.get("firstName"); // use hash instead of above class no burden of creating class .. read data into hashmap
String input_error = read error conditon from the data inptut file . // ERR_REQIRED_FIRSTNAME
flowstat = new FlowStatus(flowstatStr); // read from hidden filed
// FlowStatus class will parse differnet part of the flowStatus string
if ( flowstat.errorEquals(input_error) { test case success}
else { test case failure }


1. Test data beds: this can be in simple form of text file ( may be like FIT , FITNESS test data study )
- each field level exhastive tests are performed with auto generated 'field domain' xml defintions given in the post just below this post .
- the following is simple functional test. The actual strings 'firstName' 'phoneNum' are taken from field definitions file , these should match exact names to what HTTP POST/GET expects . WatiJ scirpt will use this file/names to auto enter the these test values in browser test
errorType | firstName | LastName | phoneNum | Address1 | Address2
ERR_REQIRED_FIRSTNAME |
ERR_REQUIRED_lastName | joe |
ERR_REQUIRED_phoneNum | Joe | hopper
ERR_REQUIRED_address1 | joe | hopper | 4083349890

you see above , the error condition ( that returns in web pages ) is coded in the test case itself .
---------------------------------------------------
When you ask a software engineer 'on Avarge how long does it take to fix a production bug in your software application ?' .
you get many answers, it depends on bug complexity , experience of programmer etc.. Here is the key , even though many of above are true we should have a avarge number . For most of the buisness applications my guess is it is like 1/2 to 1 day depnding on how complex/ easy is the aplication.
Developers spend most of the time in pinponting what exactly caused the bug, often is is hard to re-produce ( bug logged by QA engineer with some screen shots ).
Here is a set of Next genration development tools and practices to cut down software deveopoment time (same goes for bug fixing) by 50% over the current practices .

post 2: how to pinpoint what code change caused this bug
1. The idea is to log each method a use case is traversed in the code and log all those methods.
2. when you see a bug compare the 'code travese' between current version and bug-free base version (prior version).

how to log 'code traverse' methods: on a browser front end provide a key combinagton like CTRL+ALT+L a java script popus a text box enter 'tracking key' like 'UserRegigartionConfirm' a hidden filed is populated with this value and is added to each form submit on the page.
On the server 'key' value is captured and used by aspects to log 'entey' of each method. Use Aspects of Spring to log each method name entry .
3.You repetat same for the bug-free version on a different pool
4. At the end a toll do the Differene of these 2 runs and log only methods that have a difference in code.
5. Using a UI tool go over each method and see what is the diff of the methods , you can easily figure out which method caused this change.

Free File Comparison Utilities - Win Merge
-------------------------------------------
Post 1:
1. All cases business use cases are not captured in one place along with all error codes/conditions
2. incremental data progression is required

let us take REI page with fileds first name, last name , city, state, zip, phoneNumber

we define domains similar to domain names in Database desgin tools ( ERWin ..)


define domains:

nameThing
10
30
[a-z][A-Z][0-9]_-



phone
7
10
[0-9]


now we define fields with requied overridding default values of domain.

nameThing



nameThing


now the test suite will genereate test cases for these automatically like this below. Notice all cases below by default they are negaive test


*(
$(
1$(
$1(
$1a(
a$*(
a
ab
ab345678 // only 8
ab34567890ab34567890ab3456789011 // more than 30
ab3456789 // just 9 , success case for this field , there should NOT be ERRFirstName in output
getTestSuite.get("FirstName") // to read from a DB or flat flie of valid values


Functional testing: for Business applications
- as TestNG creator pointed out in his blog below functional testing is must. so for REI page he is functional test cases

REI-highrisk-user
by annonymous email
Supply Date here ..



REI-highrisk-user
by userid with _5620
Supply Date here ..



REI-lowrisk-user
by non-annonymous email
Supply Date here ..



REI-lowrisk-user
by userid normal
Supply Date here ..

software testing frameworks tools

http://www.openqa.org/ - this site has many frameworks mentinoned . Selenium , Watir is main

This Wiki link has all testing frame works in the world
http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#Java
Cactus show no new development after 2007 , JunitEE is next seems

-----------------
TestNG documentation

TestNG 5.6 and Junit 4.4 : which framework you will choose for unit testing? -- Published February 29, 2008 Java
http://lijinjoseji.wordpress.com/2008/02/29/testng-56-and-junit-44-which-framework-you-will-choose-for-unit-testing/
- asr note: this blog author LiJin is in India ( see about Linkedin profile , he can be good consultant in India for Spring , TestNG related issues )

Next Generation Java Testing: TestNG and Advanced Concepts - amazon book reviews - TestNG creator ( and author of this book )is Google engineer
- on his blog he says this: Keep in mind that functional tests are the only tests that really matter to your users. Unit tests are just a convenience for you, the developer. A luxury. If you have time to write unit tests, great: they will save you time down the road when you need to track bugs. But if you don't, make sure that your functional tests cover what your users expect from your product.
- asr note: this supports my point focus more on functional test covering every case and have data to support it. In case of REI page after REI submit you can have WatiJ get emailaddress from web page and query DB to get 'confirmation code' and feed it to go to next page .

They even go into Spring's test mechanisms, and do a good job with it.
------------------------------

Watij - Web Application Testing in Java
Watij (pronounced wattage) stands for Web Application Testing in Java. Watij is a pure Java API created to allow for the automation of web applications. Based on the simplicity of Watir and enhanced by the power of Java, Watij automates functional testing of web applications through a real browser. Currently Watij supports automating Internet Explorer on Windows only. Future plans are in place to support others like Mozilla .

Watij is a Java API that provides control and automation of Internet Explorer in order to test web applications. It was created out of the need to have a reliable, easy to use, and robust web application testing tool using Java as the scripting language. But why Java?

With Java at your fingertips you have access to a tremendous amount of existing libraries and tools. This means in your test scripts you are not restricted to testing only web applications. For example with Java you can write a test that calls a web service to do some processing and in the same test bring up your web application using Watij and validate that everything is correct. And if your web application is developed in Java, Watij integrates nicely into your already existing environment.

With Watij you can imitate real user interaction with your web application. Simple user actions like navigating, clicking links, filling out forms, and validating content are a breeze with Watij. Watij also makes it easy to handle more complex actions like file downloading and uploading, popup windows and dialogs, and screen captures.

Finding HTML elements on a page can be a cumbersome task using the traditional DOM. To make this easier Watij includes a powerful element finding capability that allows your scripts to find, access, and control any HTML element on the page. It even supports XPath expressions that are lightning fast.

Watij is a standalone Java API that purposely doesn’t force you into using a proprietary testing framework or IDE. Two of the most popular Java testing frameworks are JUnit and TestNG, and Watij integrates seamlessly with either one. Watij is just like any other Java library, so it’s very is easy to import into your favorite Java IDE like Eclipse or IntelliJ. And even though its main use is in testing web applications, because it is a standalone Java API Watij is not limited to the testing paradigm.

See Watij new relesae with Eclipse support
_______________________________________________________________

Selenium used at auction gaint

Selenium is a test tool for web applications. Selenium tests run directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh. No other test tool covers such a wide array of platforms.
http://technology.amis.nl/blog/?p=1077
http://www.openqa.org/selenium-ide/
http://www.openqa.org/selenium-ide/

Wednesday, March 19, 2008

Demonstrating Spring's Finesse

Spring IDE
using Spring IDE

______________
asr notes: what are the real real advantages spring as development platform ( my own view )
1. JDBCTemplates -- great to get sql result in one line
2. aspects for 'log messages' and security checks
3. INput FORM data validation declaratively , ability to define masks like for phone numbers etc.
4. ability to use caching ( JCS, hybernate ) built in interfaces provided
5. Good webflow module works with JSF , struts etc..
_______________________________

discard all below old stuff

Note: this is written in 2005 very old spring , probably get new Spring 2.0 application code
JpetStore -- app this author talks about
- download from here
- app demo

Author's note: In this excerpt from Chapter 8 of our book, Better, Faster, Lighter Java, we look at an example of an enterprise web application using the Spring framework. While Hibernate provided a single service, the Spring framework provides an efficient way to build and assemble Java applications, with abstractions for many services. Although it supports many services, Spring stays focused and clean with excellent layering and encapsulation. Like EJB, the centerpiece for Spring is a container, and like EJB, the Spring framework provides access to core J2EE services. But that's about as far as any similarities go. ( no more similarities with EJB ).

Pet Store: A Counter-Example
The J2EE Pet Store application is an infamous programming example gone bad. It taught thousands of J2EE developers to build poorly designed, poor-performing code. It was also the center of a benchmarking controversy

Data sources

A Java class that manages connections, usually in a pool.
DAO layers

If your applications use a database, you probably want to isolate the database access to one layer, the DAO. You can access this layer through the application context.
Persistence managers

Every persistence framework has an object or factory that the application uses to access its features. With Hibernate, it's the session and the session factory. With JDO, it's the persistence manager factory and persistence manager.
Transaction policies

You can explicitly declare the methods that you want to participate in transactions and the transaction manager that you want to use to enforce that strategy.
Transaction managers

There are many different transaction management strategies within J2EE. For single database applications, Spring lets you use the database's transaction management. For multiple databases or transaction sources, Spring allows JTA instead. You can keep the transaction manager in the application context.
Validation logic

The Spring framework uses a validation framework similar to Struts. Spring lets you configure validation logic like any other business component.
Views and controllers

The Spring framework lets you specify the controllers for a view and helps you configure the navigation path through them.

The jPetStore application uses the Spring application context for a data source, the DAO layer, and a transaction strategy. You define what goes into a context within an XML document that lists a series of beans

TDD - Test Driven Development

Test Driven: TDD and Acceptance TDD for Java Developers
- new book written in Nov 2007 , many other books are old

Maven 2 - build and project collaboration tool

"Spring in Action" - Author mentioned in book ( using it )

Introduction to Apache Maven 2 - Tutorial

Modern software projects are no longer solely monolithic creations of single local project teams. With the increased availability of robust, enterprise-grade open source components, today's software projects require dynamic collaboration among project teams and often depend on a mix of globally created and maintained components. Now in its second generation, the Apache Maven build system -- unlike legacy build tools created before the Internet-enabled era of global software development -- was designed from the ground up to take on these modern challenges. This tutorial gets you started with Maven 2.


Learning Maven 2 need not be difficult, once you understand its motivation and the challenges that it aims to overcome. As a build tool, Maven 2 is usable productively even by rank beginners developing projects in an isolated silo. Start using Maven 2 in your own development project or join one of the many open source development communities, and soon you too will be influencing the course toward which Maven 2 will evolve.

Working with the Maven 2 Plug-in for Eclipse 3.2 -- Nice UI tool

Tuesday, March 18, 2008

AOP / Dependency Injection (DI).

http://static.springframework.org/spring/docs/2.0.x/reference/aop.html
Implement crosscutting concerns using Spring 2.0 AOP Spring 2.0 offers excellent user-friendly AOP capabilities
By Ganesh Ghag, JavaWorld.com, 01/05/07

Most developers will acknowledge how implementing crosscutting concerns such as logging, auditing, security and transactionality can adversely affect business logic implementation. Such concerns "seem" to increase the complexity of existing business logic, at times making it difficult if not impossible to clearly distinguish business logic from the crosscutting concern implementation.

I had been hearing about aspect-oriented programming (AOP) being a solution for implementing crosscutting concerns. But having read through early AOP tools documentation, I was dissuaded from using AOP in my projects' recommendations, primarily because of a concern that average developers might not "get" AOP concepts, and the overall ability to debug applications, and maintain them, might be restricted to those few who understood AOP.

Recently released Spring 2.0 provides excellent, easy-to-use AOP capabilities. Spring AOP is now remarkably easy to use for the average Java developer with traditional object-oriented programming skills. This story shows how Spring 2.0 AOP can be effectively used to implement crosscutting concerns in a typical software project. We will consider the following crosscutting concerns for implementation:

Security
Logging
Transactionality

Let us start with an example code snippet:

Before we begin, let's review a few basic definitions used in aspect-oriented programming and their implementation in Spring AOP.

AOP basics
Aspect: A modularized implementation of a software concern that cuts across various objects in a software implementation. Logging is a good example of an aspect. In Spring AOP, aspects are nothing more than regular Spring beans, which themselves are plain-old Java objects (POJO) registered suitably with the Spring Inversion of Control container. The core advantage in using Spring AOP is its ability to realize the aspect as a plain Java class.
Join point: A point during program execution, such as a method executing or an exception being handled. In Spring AOP, a join point exclusively pertains to method execution only, which could be viewed as a limitation of Spring AOP. However, in reality, it is enough to handle most common cases of implementing crosscutting concerns.
Advice: Information about "when" an aspect is to be executed with respect to the join point. Examples of types of advice are "around," "before," and "after." They specify when the aspect's code will execute with respect to a particular join point.
Pointcut: A declarative condition that identifies the join points for consideration during an execution run. Pointcut is specified as an expression. Spring AOP uses the AspectJ pointcut expression syntax. An example pointcut expression is: execution(* com.myorg.springaop.examples.MyService*.*(..)). Asterisks in the expression refer to wildcards, as is conventional.

The above AOP code can be easily compiled with the Java 5.0 compiler. There is no need for a separate AOP compiler. Spring uses Java 5.0 dynamic proxies to implement Spring AOP. Needless to say, the weaving of Spring AOP aspects into the application code occurs at runtime, because of the use of dynamic proxies.


Logging as an AspectLogging has a lot of characteristics that make it a prime candidate for implementation as an aspect. The following are two of the notable characteristics:
Logging code is often duplicated across an application, leading to a lot of redundant code across multiple components in the application. Even if the logging logic is abstracted to a separate module so that different components have a single method call, that single method call is duplicated in multiple places. - asr: It seems you do not have to call logging in Spring AOP one declaration of what all classes need logging seems takes care

Logging logic does not provide any business functionality; it's not related to the domain of a business application.

________________________________________________________________________________
Learn AspectJ to better understand aspect-oriented programming -- 03/01/02
AspectJ language overview
To support AOP, AspectJ adds to the Java language concepts:


Joinpoints: Points in a program's execution. For example, joinpoints could define calls to specific methods in a class
Pointcuts: Program constructs to designate joinpoints and collect specific context at those points
Advices: Code that runs upon meeting certain conditions. For example, an advice could log a message before executing a joinpoint

Aspect Hello world
Add Japanese manners to HelloWorld
Now that you've seen the around() advice and collecting context, let's use it to add manners, Japanese style, by adding a "-san" suffix to each person's name to show respect. We simply add another aspect: JapaneseMannersAspect. This aspect advises the call to HelloWorld.sayToPerson(String, String) and proceeds with a modified person argument by adding "-san":

// JapaneseMannersAspect.java
public aspect JapaneseMannersAspect {
pointcut callSayMessageToPerson(String person)
: call(* HelloWorld.sayToPerson(String, String))
&& args(*, person);
void around(String person)
: callSayMessageToPerson(person) {
proceed(person + "-san");
}
}



__________________________________________________________________________________
A Beginer guide to Dependency Injection (DI). - dated July 2005


Scope
This article presents a high level overview of Dependency Injection (DI). It aims to present the overall concept of Dependency Injection to the junior developer within the context of how it could be used in a variety of DI containers.


Dependency Injection (DI) or Inversion of Control (IOC) ? A lot of current literature often refers to the same design pattern as either Dependency Injection or Inversion of Control. I prefer Dependency Injection from my belief that it is a more specific name. I can imagine many scenarios where one would find evidence of Inversion of Control, though the resultant pattern is unlikely to be focusing on resolving dependencies (e.g. moving from a console application to a Windows Event Loop) . However should you prefer IOC, you can pretty much read the remainder of the article by replacing DI with IOC. Within IOC there are various types (creatively called as type 1, type 2, type 3). The differences within these types are not particularly relevant to the scope of this article and thus not entered into.

Dependency Injection in a Software Context
Software components (Clients), are often a part of a set of collaborating components which depend upon other components (Services) to successfully complete their intended purpose. In many scenarios, they need to know “which” components to communicate with, “where” to locate them, and “how” to communicate with them. When the way such services can be accessed is changed, such changes can potentially require the source of lot of clients to be changed.

Saturday, March 15, 2008

Spring Web Flow for better workflow management in JSF

Spring Web Flow for better workflow management in JSF
An alternative to the JavaServer Faces CustomNavigationHandler

By Ravi Shankar Nair, JavaWorld.com, 01/10/08

JavaServer Faces is a powerful framework for component-based Web UI development, but its CustomNavigationHandler introduces more complexity into rules-based navigation than you need. In this article, Ravi Shankar Nair shows you how to integrate a little flow -- Spring Web Flow, that is -- into an existing JSF application, bringing truly customizable and reusable navigation to your evolving JSF applications.

-- show also good flow model of JSF


------
Spring webflow - 2005 aritcle
http://www.theserverside.com/tt/articles/article.tss?l=SpringWebFlow