通过OOP进行问题分析和解决 [英] Problem analysis and solving through OOP
问题描述
我是OOP的新手.我想学习有关通过OOP进行分析和解决问题的信息.
如果有人给我一个明确的想法,关于如何使用OOP概念分析和解决以下系统,我将非常感激.
解决此问题需要什么类,属性和方法.
系统很简单-
1.有一个包含两个表的数据库-case_memo(CM_NO,CUST_NAME,CM_DATE)和case_memo_detail(CM_NO,ITEM_NO,ITEM,QTY,PRICE)具有1toN关系.
2.需要添加新的/删除/更新的案例备忘录及其案例备忘录详细信息.
I''m new in OOP. I want to learn about analyzing and problem solving through OOP.
I''ll be very oblige if anyone give me a clear cut idea regarding how to analyze and solve the following system using OOP concept.
What classes, properties, and methods should be needed to solve this problem.
System is very simple-
1. There is a database containing two tables - case_memo(CM_NO, CUST_NAME, CM_DATE)and case_memo_detail(CM_NO, ITEM_NO, ITEM, QTY, PRICE) which have 1toN relationship.
2. Adding new/Deleting/Updating case memo along with its case memo details will be needed.
Thanks in anticipation.
推荐答案
我建议Begginers撰写有关OO Anylasis和软件设计的书.
我可以高度推荐HeadFirst系列的以下内容:
[ http://www.freetutes.com/systemanalysis/ [
I''d suggest a Begginers book about OO Anylasis and Design of Software.
I could highly reccomend the following of the HeadFirst Series:
[^]
But there are also, some good Online Tutorials available
See for example here:
http://www.freetutes.com/systemanalysis/[^]
感谢您的答复Logor.
对于上述系统,i''v创建了两个类-
1. CaseMemo
Thanks for your reply Logor.
For the above mentioned system i''v created two classes -
1. CaseMemo
Public Class CaseMemo
#Region "Properties"
Private _CM_NO As Integer
Public Property CM_NO() As Integer
Get
Return _CM_NO
End Get
Set(ByVal value As Integer)
_CM_NO = value
End Set
End Property
Private _CUST_NAME As String
Public Property CUST_NAME() As String
Get
Return _CUST_NAME
End Get
Set(ByVal value As String)
_CUST_NAME = value
End Set
End Property
Private _CM_DATE As Date
Public Property CM_DATE() As Date
Get
Return _CM_DATE
End Get
Set(ByVal value As Date)
_CM_DATE = value
End Set
End Property
#End Region
#Region "Methods"
Public Function AddCaseMemo() As Boolean
'' My Insert code
End Function
Public Function DeleteCaseMemo() As Int16
''My Deletion Code
End Function
Public Function UpdateCaseMemo() As Int16
'my Update code
End Function
#End Region
End Class
和
2. CaseMemoDetails
and
2. CaseMemoDetails
Public Class CaseMemoDetails
#Region "Properties"
Private _CM_NO As Integer
Public Property CM_NO() As Integer
Get
Return _CM_NO
End Get
Set(ByVal value As Integer)
_CM_NO = value
End Set
End Property
Private _ITEM_NO As Integer
Public Property ITEM_NO() As Integer
Get
Return _ITEM_NO
End Get
Set(ByVal value As Integer)
_ITEM_NO = value
End Set
End Property
Private _ITEM As String
Public Property ITEM() As String
Get
Return _ITEM
End Get
Set(ByVal value As String)
_ITEM = value
End Set
End Property
Private _QTY As Integer
Public Property QTY() As Integer
Get
Return _QTY
End Get
Set(ByVal value As Integer)
_QTY = value
End Set
End Property
Private _PRICE As Double
Public Property PRICE() As Double
Get
Return _PRICE
End Get
Set(ByVal value As Double)
_PRICE = value
End Set
End Property
#End Region
#Region "Methods"
Public Function AddCaseMemoDetail() As Boolean
'' My Insert code
End Function
Public Function DeleteCaseMemoDetail() As Int16
''My Deletion Code
End Function
Public Function UpdateCaseMemoDetail() As Int16
'my Update code
End Function
#End Region
End Class
现在,我很困惑在CaseMemo中是否需要CaseMemoDetails的属性/字段.如果您能启发我,我将不胜感激.
Now I''m confused whether a property/field of CaseMemoDetails will be needed inside the CaseMemo. I''l be very grateful if you enlighten me.
这篇关于通过OOP进行问题分析和解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!