旅店管理系统中clerk的详细描述

在“旅店管理系统中的类的概述”完成之后,我又仔细的审查了自己关于各个类的定义,我发现自己竟不知不觉地走入了EJB(Enterprise JavaBean)的范畴,从我在前文中定义的概念可以看出其中房间信息,预定信息以及租用信息属于EJB中的实体Bean(确切地说应该是实体Bean中的Bean类我将它称之为实体类),而管理人员和旅店服务人员应该是EJB中的会话Bean中的Bean类(我在这把它叫做会话类)。(另外查询信息,是一个没有很好地解释的类,正像前面说得那样,这个类的存在与否是一个问题所在。)我不知道别人在实际的实际过程中会不会出现这样的情况,是我感到疑问的是在没有出现EJB之前,程序设计者在分析设计的过程中也会得到这样的结果吗?如果是这样的话,EJB这种概念应该是在java出现之前就应该出现,是不是像我说得这样呢?希望那位知道的读者告诉我关于OO的设计过程中是不是很早就提出了这种对于对象的分类。

而如果情况真的如我分析的那样的话,我们在实体类中就没有过多的内容要详细描述(可能会在数据库的定义之后进行详细地描述),因为实体Bean的作用主要是想JDBC或者其他一些后端的API经常访问的数据提供一个面向对象的接口,也就是说实体类其实是对数据库的内容在程序中的一种体现。当然我们在具体实现的过程中可能会使用特殊的处理手段,比如将某字段作为对象单独处理等。我在下面只是简单得给这些类(本以为这些内容会以接口的形式存在,从而便与支持网络,不想不知不觉走入了EJB的范畴,)一个名字以供下面的内容使用。

1、房间信息:RoomInfo
2、预定信息:ReserveInfo
3、租用信息:RentInfo

接着我们来处理一下旅店服务员这个主要的会话对象的主要几个功能,并把它们定义成旅店服务员的方法(关于管理员的查询以后再作补充)。

我们先为旅店服务员着个类起名为HostelClerk,一下是HotelClerk类的主要部分(没有提供对于会话Bean接口的实现)。

import java.util.*;

/*
 * Created on 2003-7-28
 */

/**
 * This class is used in Hostel MIS. It is the class which implements
 * room renting, reserving, check out and other main function.
 *
 * @author idilent
 */
public class HostelClerk {
 

 /**
  * This method is used to get the available rooms when the clerk
  * reserves or rents room for the custommer.
  *
  * @param roomPrice the price of the room
  * @param fromDate the date from which the room will be rented
  * @param toDate the date to which the room will be rented
  * @return the available rooms.
  *
  * there may be should a class call SearchCondition which encapsulates
  * the search conditions
  *
  */
 public RoomInfo[] availableRooms(Currency roomPrice,Date fromDate,Date toDate){
  return null;
 }
 
 /**
  * This method is used to rent a room,since the availableRooms method had to be
  * called before this function(else you will have no idea of which room is availble
  * to rent), so we can get a roomID form the RoomInfo[] which is the result of
  * availableRooms method.
  *
  * @param roomID the roomID is the primary key of the room information
  * @param fromDate the date from which the room will be rented
  * @param toDate the date to which the room will be rented
  * @param customerName the customer's name, there should be other information of
  * the customer. Maybe a class which supports the customer infor is needed.
  */
 public void rentRoom(int roomID, Date fromDate, Date toDate, String customerName){
 
 }
 
 /**
  * This method is used to reserve a room,since the availableRooms method had to be
  * called before this function(else you will have no idea of which room is availble
  * to rent), so we can get a roomID form the RoomInfo[] which is the result of
  * availableRooms method.
  *
  * @param roomID the roomID is the primary key of the room information
  * @param fromDate the date from which the room will be rented
  * @param toDate the date to which the room will be rented
  * @param customerName the customer's name, there should be other information of
  * the customer. Maybe a class which supports the customer infor is needed.
  */
 public void reserveRoom(int roomID,Date fromDate, Date toDate ,String customerName){
 
 }
 
 /**
  *
  * used to cancel reservation, if the customer remebered the reserveInID.
  *
  * @param reserveInfoID the primary key of reserveInfo.
  */
 public void cancelReservation(int reserveInfoID){
 
 }
 
 /**
  * used to cancel reservation when the customer forget the reserveInfoID
  * Of course he should remeber his name though he could forget anything. 
  *
  * @param customName supports the search the reserveInfo which should be canceled.
  */
 public void cancelReservation(String customName){
 
 }
 
 /**
  * used to check out.
  *
  * @param RoomID the roomInfo primary key
  *
  * Do you think there should be another version of the checkOut?
  * maybe, but I think the roomID is always available. It may be the room's key name.
  */
 public void checkOut(int RoomID){
 } 
}

好了,这个旅店系统的开发文档就在这里告一段落。其中内容必然让所有的人大失所望。但是这也不是我希望的结果。无论如何,谢谢大家。


版权所有:idilent 网站转载请注明作者 其他转载方式请与作者联系(idilent@yahoo.com.cn)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值