★ wanayoo — archive 1999 http://www.webtools.com/story/java/TLS19990421S0001Nouvelle recherche | Portail wanayoo
CMP's TechWeb Click Here to Vist CMPNET


WebTools

Search WebTools
 

Article Level
  BEGINNER
   INTERMEDIATE
   ADVANCED

Click Here to Vist CMPNET

 
WebTools members,
log in.

  Toolboxes
  Browsers
  HTML, XML, & CSS
  Graphics & Design
  Multimedia
  DHTML & JavaScript
  Java
  Servers & E-Commerce
  Scripting
  Demo

  All Articles
  Tips & Tricks
  About WebTools

TechWeb Sites
 Byte.com
 CMPmetrics
 Data Communications
 File Mine
 InformationWeek
 InternetWeek
 Network Computing
 Planet IT
 TechShopper
 TechWeb News
 Tele.com
 WebTools
 Winmag.com

  Free E-mail
 Login - Sign Up Now

Click here to visit Alta Vista Get Pointcast free

  Privacy Statement

WebTools: Java
 Article Level   INTERMEDIATE  
Sex, Java, And Beans

By Piroz Mohseni, WebTools (04/21/99)

It is doubtful that the creators of JavaBeans expected one day to see a "sex" Bean, but that is exactly what South Shore Machine Tools has come up with. SexMachineBean is a JavaBean that examines a database table where one of the fields is the first name of individuals. It will then determine what gender the name belongs to and come up with an appropriate salutation (i.e., Mr. or Ms.).

Although reusability is a major theme with component models such as JavaBeans, another important aspect is components ought to be designed to perform specific functions and do them well. The JavaBean specification provides a framework for creating specific functional units called Beans that can interact with each other to create larger and more complex applications. There is nothing in the specification to prevent one from creating a very complex Bean that does many things, but such Beans break the spirit of component-based software development, and usually, they don't tie in very well to other Beans.

Focused On One Task
The SexMachineBean is focused on doing one thing -- to determine the gender of a given first name. The software is shipped as a jar file. You can create a directory called smbdemo on your C drive and copy the jar file there. Then issue the following command to extract all the files:

jar --xvf smbdemo.jar

Note that jar is a utility program that ships with the JDK and lets you package your Java application and their supporting files. The program needs a database table where one of the fields contains first names of individuals.

On the Windows NT platform, you can use a simple Access database to store your table. Access even comes with a sample "address book" database you can use. The output of SexMachineBean is a replicate of its input table with an additional field containing the salutation. You therefore must have write access to the database so this output table can be created.

In This Article:
Sex, Java, And Beans
Configure Access First
Gender ID Algorithm Not Revealed
print
Print this story
email
Send as
e-mail


Get all the code that's fit to post from WebTools' Gamelan directory


Keep track of Java news with Planet IT's Java Tools Index.

Related Stories

WebTools Home | Browsers | HTML, XML, & CSS | Graphics & Design | Multimedia | DHTML & JavaScript | Java | Servers & E-Commerce | Scripting | Demo | All Articles | Threads | WebTools News | Tips and Tricks


C M P n e t   S H O P P I N G
MacTuner V2.1 for Mac
$22.95
Tune in to over 1800 live TV and radio broadcasts and get the most out of your RealAudio and RealVideo players.
Divider
BBEdit V5.1 for Mac
$98.99 !! save 17% !!
A fast, easy, Mac-based HTML authoring tool used by most professional Web Designers.
McAfee VirusScan V4.0 for Win95
$7.99 !! after rebate !!
Protect your PC from all virus types, and receive updates directly on your desktop the moment they're released.

CMPnet Click Here to Vist CMPNET