class-design

Is UML practical? [closed]

心不动则不痛 提交于 2019-11-26 09:15:30
问题 In college I\'ve had numerous design and UML oriented courses, and I recognize that UML can be used to benefit a software project, especially use-case mapping, but is it really practical? I\'ve done a few co-op work terms, and it appears that UML is not used heavily in the industry. Is it worth the time during a project to create UML diagrams? Also, I find that class diagrams are generally not useful, because it\'s just faster to look at the header file for a class. Specifically which

How would you code an efficient Circular Buffer in Java or C#?

青春壹個敷衍的年華 提交于 2019-11-26 01:58:19
问题 I want a simple class that implements a fixed-size circular buffer. It should be efficient, easy on the eyes, generically typed. For now it need not be MT-capable. I can always add a lock later, it won\'t be high-concurrency in any case. Methods should be: .Add() and I guess .List() , where I retrieve all the entries. On second thought, Retrieval I think should be done via an indexer. At any moment I will want to be able to retrieve any element in the buffer by index . But keep in mind that

How will I know when to create an interface?

北城以北 提交于 2019-11-26 01:10:00
问题 I\'m at a point in my development learning where I feel like I must learn more about interfaces. I frequently read about them but it just seems like I cannot grasp them. I\'ve read examples like: Animal base class, with IAnimal interface for things like \'Walk\', \'Run\', \'GetLegs\', etc - but I\'ve never been working on something and felt like \"Hey I should use an interface here!\" What am I missing? Why is it such a hard concept for me to grasp! I am just intimidated by the fact that I

What is the purpose of a marker interface?

橙三吉。 提交于 2019-11-26 01:06:56
问题 What is the purpose of a marker interface? 回答1: This is a bit of a tangent based on the response by "Mitch Wheat". Generally, anytime I see people cite the framework design guidelines, I always like to mention that: You should generally ignore the framework design guidelines most of the time. This isn't because of any issue with the framework design guidelines. I think the .NET framework is a fantastic class library. A lot of that fantasticness flows from the framework design guidelines.

What is the purpose of a marker interface?

你离开我真会死。 提交于 2019-11-26 00:55:38
What is the purpose of a marker interface? Scott Wisniewski This is a bit of a tangent based on the response by "Mitch Wheat". Generally, anytime I see people cite the framework design guidelines, I always like to mention that: You should generally ignore the framework design guidelines most of the time. This isn't because of any issue with the framework design guidelines. I think the .NET framework is a fantastic class library. A lot of that fantasticness flows from the framework design guidelines. However, the design guidelines do not apply to most code written by most programmers. Their

Why is __init__() always called after __new__()?

℡╲_俬逩灬. 提交于 2019-11-25 21:49:05
问题 I\'m just trying to streamline one of my classes and have introduced some functionality in the same style as the flyweight design pattern. However, I\'m a bit confused as to why __init__ is always called after __new__ . I wasn\'t expecting this. Can anyone tell me why this is happening and how I can implement this functionality otherwise? (Apart from putting the implementation into the __new__ which feels quite hacky.) Here\'s an example: class A(object): _dict = dict() def __new__(cls): if \