Archive for the ‘Software Dev’ Category
Combining Agile Methodologies – XP and Scrum
Since XP is more focused on development practices(engineering), while Scrum more towards project organization(management), it seems possible to combine this 2 methodologies.
Having experience both agile methodologies separately, here’s my take on the must-haves.
- Planning
- Daily Standup(XP/Scrum) – What you done yesterday, going to do today, obstacles if any.
- Break down requirements into user stories (XP), then put them into a product backlog using excel or web tools like acunote (Scrum)
- Physical task-board for easy and quick viewing of sprint tasks
- Coding
- Test Driven Development(TDD) by writing the unit tests first. (XP/Scrum)
- No one owns any particular code. All code can be changed by anyone. And codes are integrated often. Thus a source control system(CVS, SVN, VSS, etc) have to be in place. (XP)
- Testing
- All code must be tested before putting to production. (XP)
- When bugs are found, new unit tests are written to guard against repeats. (XP)
- Releasing
- Have a demo before release and review after release. (Scrum)
- Release early, release often as they say. (XP). Preferably keep a sprint within weeks rather than months.
Interesting Differences.
- XP prefers having no overtime anytime, anyday, while scrum prefers no rest within a sprint, which probably means no off days and leave, unless urgent, for a good 3-4 weeks.
Summary
Majority of the coding and testing rules come from XP, while planning rules come from SCRUM. The key is to keep the rules flexible. Sprint reviews after each sprint allows you to better fine-tune your rules, based on team strength/weakness or project nature. Well, as long as they work for you.
Free Scrum/XP E-book
Ajax App Server? – AjaxToaster
“AjaxToaster is an Ajax application server which makes it easy to create RESTful web services for rich web client applications. It runs under any of the main Java servlet containers (tomcat/glassfish/websphere/jboss/jetty)”
Still in RC though. I haven’t managed to take a closer look, but the request/update urls doesn’t look too restful to me.
http://localhost:8080/toaster?service=recipe/RetrieveAll&returnjson
http://localhost:8080/toaster?service=meetings/UpdateMeetingRoom&inputjson={"Room":[{"RoomCode":"AZALEA","RoomName":"The Azalea Room"}
Hmm, not too sure anyone had a go at this project.
Symbolic link case sensitive in linux but not in mac os leopard
Yeah, try it.
First Flex Play-around
This is a great explorer site for flex sample effects.
http://flexapps.macromedia.com/flex15/explorer/explorer.mxml?versionChecked=true
Time to abandon the Waterfall SDLC and/or Business Analysts?
Part 1 – Abandon Waterfall SDLC?
I feel gone are the days whereby software companies should force customers to sign off system requirements.
Reason? There is no guarantee that the requirements gathered during the “System Analysis” phase of the Waterfall cycle is fully complete. So if you’re forcing the customer to sign off and get ready to accept something that they might not fully embrace after delivering, then there might be a problem late on.
Instead of contract disputes in the end, why not have constant customer collarboration/communication throught the lifecycle through an agile development methodology like Extreme Programming or Scrum? Customer should be as involved with the success of the project as the project development team.
Your company is foolish not to tap on the customer’s feedback during the project development. At the end of the day, it’s the customer who mark the acceptance tests.
Part 2- Abandon Business Analysts?
This one is abit controversial. Did i meant let the developers take over the job of business analysts? Possible, why not? Developers are supposed to be smarter than BAs, although BAs generally have better communication skills. Generally developers create prototypes anyway, so if there is any mis-communication, changes can be done swiftly.
The key problem is having good communication skills alone does not allow a BA to analyst customer IT problems and churn out technical user requirements/specifications.
It is easier to find a developer with decent communication skills than a sound business analyst with development background or is IT-savvy. And if you ever find one, do whatever it takes to keep him/her. My working experience also made me believe that BAs should come from a technical background. It improves the specs they write, trust me.
Even though generally managers prefer decision-biding employees rather than employees whom speak up and challenge decisions, you can be sure you’ll get more of those if you have such developers. “Can’t these developers just write the damn code” they thought. I’m one of those. CTOs doesn’t scare me 1 bit.
I generally prefer to gather requirements directly from customers. If information gets filtered by BAs, 100% customer requirement accuracy might just be left 80%. If specifications are written incorrectly, you are left with maybe 60%.
XP suggests that a customer be placed at the development site, Thoughtworks practises placing the development team within the customer’s site, with the latter sounding more practical to me. Simply having a key customer decision maker’s MSN account would be fine for me though.
Strings
String s = "f" + "o" + "o"- The comparison
('a' == s.charAt(0)) - The StringBuffer default capacity is 16. If your string is going to be larger than that, you might as well reserve a larger capacity by passing a realistic length such as
StringBuffer sb = new StringBuffer(1024);
is faster than
String s = "f";
s+="o";
s+="o";
is faster than
s.startsWith("a");
Spring Hibernate DAO Implementation with interface
Intro
Assuming we have a module called Account Management in our project called foo,
We might can make use of the following package structure.
- foo.service.AccountManagement
- foo.service.AccountManagementImpl
- foo.dao.AccountDAO
- foo.dao.hibernate.AccountDAOImpl (In this case hibernate)
- foo.model.Account
Spring Wiring
<bean id="accountDAO" class="rb.dao.hibernate.AccountDAOImpl"></bean>
<bean id="accountManagement" class="foo.service.AccountManagementImpl">
<property name="accountDAO">
<ref bean="accountDAO"/>
</property>
</bean>
So note that you can replace the accountDAO with some other implementation class, probably using pure JDBC or ibatis.
Summary
As the experts say, always code to interfaces to cater for different implementations.
Marshalling Objects To/From XML (Java and Python)
Python (Using PyXML)
#
# Install PyXML from http://pyxml.sourceforge.net/
#
from xml.marshal.generic import Marshaller, Unmarshaller
class Company:
def __init__(self, name, year_founded, ceo):
self.name = name
self.year_founded =year_founded
self.ceo = ceo
def __str__(self):
return "%s %s %s" % (self.name, self.year_founded, self.ceo)
c = Company('Google Inc.', '1998', 'Eric Schmidt')
# Marshalling
marshal = Marshaller()
xml = marshal.dumps(c)
print xml
# Un-Marshalling
um = Unmarshaller()
obj = um.loads(xml)
print obj
Java (Using XStream)
The people at ThoughtWorks makes it easy. Just read here.
Collaborating threads using CyclicBarrier (Java 5)
Recently, i came across this problem.
Write a java program that prints out the line “Started” to the console and then creates 10 threads. Each thread should print the lines “Thread x started”, “Thread x finished” where x is the thread number (0 to 9). The program should then print the line “Terminated”. No thread should print the finish message until all threads have printed the started message. The final “Terminated” message should be printed as soon after the last finished message has been printed.
The interesting thing is all the threads have to wait for each other to reach a common point before being allowed to terminate. This common point is known as the CyclicBarrier in java speak.
I did some quick research and came across this class under the java.util.concurrent package. So using this class i managed to complete this problem in about 1+ hrs (Includes refreshing my memory of threads =D).
Python SOAP Clients
Motivation
You want to invoke web services methods using python code.
There are few python libraries for python web service.
2 commonly used and stable python libraries to invoking web services are:
SOAPpy and ZSI
see http://pywebsvcs.sourceforge.net/
SOAPpy
Use SOAPpy for simple soap method calls that expect only simple type arguments(string, int, etc)
Setup
Follow the steps in http://www.diveintopython.org/soap_web_services/index.html
Sample Code
- List available methods offered by a SOAP server
from SOAPpy import WSDL
wsdlFile = 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl')
server = WSDL.Proxy(wsdlFile)
print server.methods.keys()
- Calling a web service through a WSDL Proxy
from SOAPpy import WSDL
wsdlFile = ‘http://www.xmethods.net/sd/2001/TemperatureService.wsdl’)
server = WSDL.Proxy(wsdlFile)
print server.getTemp(‘90210′)
server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1
temperature = server.getTemp(‘90210′)
print temperature
See http://www.diveintopython.org/soap_web_services/introspection.html
ZSI (Zolera Soap Infrastructure)
Use ZSI for simple/complex WSDL types.
Setup
1. Download the latest ZSI Egg file from here
1. Download the Easy Install tool from here.
1. Follow this to install the ZSI python egg file
Code Generation from WSDL and XML Schema
In WSDL complex types, objects might be required to be the argument to the SOAP method you want to invoke. For example, the soap method might required a Shipment object as its argument, so how do you pass in an object which your client currently do not possess?
You can create the class(s) required through file generation by passing in the WSDL url.
For python, we will be using the wsdl2py script which comes with ZSI.
1. Go to your PYTHON_HOME\Scripts , there shld be a wsdl2py file there.
1. From the same directory, run this command
wsdl2py -bu http://webservices.wolfram.com/services/SearchServices/WolframSearch2.wsdl
1. The classes that you require are generated in the same directory and available to be used.
Sample Code
- Usage of the generated code to invoke web service
Using the previous example on WolframSearch,
# import the generated class stubs
from WolframSearchService_services import *
# get a port proxy instance
loc = WolframSearchServiceLocator()
port = loc.getWolframSearchmyPortType()
# create a new request
req = WolframSearchRequest()
req.Options = req.new_Options()
req.Options.Query = 'newton'
# call the remote method
resp = port.WolframSearch(req)
# print results
print 'Search Time:', resp.Result.SearchTime
print 'Total Matches:', resp.Result.TotalMatches
for hit in resp.Result.Matches.Item:
print '--', hit.Title
Note that WolframSearchRequest is the object which is required by the WolframSearch soap method.
see here for detailed step-by-step explaination
Summary
We covered the 2 most common python web service libraries that can be used as the client to SOAP servers of different programming largely dominated by Java.
