There are several stages to object-oriented software development:
1. Object-oriented analysis (oriented, OOA)
2 Object-oriented design (oriented Design,ood)
3 Object-oriented programming (oriented Programming,oop)
4 Object-oriented testing (oriented Test,oot)
5 Object-oriented maintenance (object oriendted soft MAINTENANCE,OOSM)
1 #Target: School-----> Classification2 #Common features: trademarks of Etiantian3 #Common skills: Admissions4 #unique Features: Different addresses, teachers, courses5 6 classSchool:7tag='Etiantian' #Common features8 def __init__(SELF,ADDR):#Unique Features9Self.addr=AddrTenself.teacher_list=[] Oneself.course_list=[] A - defZhaosheng (self):#Common Skills - Pass the - - #Audience: Teacher----> Classification - #Common skills: Teach a lesson + #Unique Features: name, gender, level, course - + classTeacher: A at def __init__(self,name,sex,level): -Self.name=name -self.sex=Sex -Self.level= Level -self.course_list=[] - in defTeach (self): - Pass to + - #Audience: Student----> Classification the #Common features: * #Common skills: Search_score,handin $ #Unique Features: study number, name, gender, coursePanax Notoginseng classStudent: - def __init__(self,id,name,sex):#Unique Features theSelf.id=ID +Self.name=name Aself.sex=Sex theself.course_list=[] + defSearch_score (self):#Common Skills - Pass $ $ defHandin (self): - Pass - the classCourse: - def __init__(self,name,price,period):WuyiSelf.name=name theSelf.price= Price -Self.period=period Wu -S1=student ('123123123123','Cobila','female') About #print (s1.id,s1.name,s1.sex) $ #print (s1.course_list) - #s1.course_list.append (' python ') - #s1.course_list.append (' Linux ') - #print (s1.course_list) A +Python_obj=course ('python', 15800,'7m') theLinux_obj=course ('Linux', 19800,'2m') - $ the s1.course_list.append (python_obj) the s1.course_list.append (linux_obj) the #print (s1.course_list) the - Print(" "Student name is:%s in Course name is:%s the Course price is:%s the " "% (S1.name,s1.course_list[0].name,s1.course_list[0].price))
Example 1
For the little white advice:
1. Object-oriented programming looks tall, so I should be programming to ensure that the entire class, so the written program must be a good program (object-oriented only for those with high scalability requirements of the scene)
2. A lot of people like to say the object-oriented three characteristics (where this comes from, encapsulation, polymorphism, inheritance?) There are too many loopholes, well, for the time being called the three major features, then I am in the object-oriented programming, I must let me define the class of the complete inclusion of these three features, so write is definitely a good program
Good boy, I said the Dragon 18 Palm has 18 palm, then every time you fight with people from the first hand to hit the 18th palm This just appears you will be, I have to 10,000 people you need to play 10000*18 palm right, silly fork
3. Class has a class property, instance has an instance property, so we define class when we must define a few class properties, what to do, then hard to think, define the more the better
This makes a serious mistake, the sooner the program object-oriented, the sooner the die, why object-oriented, because we want to combine the data with the function, the whole structure of the program is not out, or need to consider the problem you have not figured out a sorta, you began to object-oriented, which led to, you are there to do, Self-thought, defined a bunch of properties, the results are not used later, or can not figure out what should be defined, it has always wanted to, think about the crazy.
You have seen a company to develop a software, to start writing, it must be a frequent meeting to discuss the plan, see section Eighth
4. Since this is so troublesome, then I completely free, we do not use object-oriented programming, you Ah, you have a big, you can do it, silly fork.
Python-based----object-oriented programming