Tag Info

New answers tagged

1

Uncle Bob has some guidelines on package separation. The first three package principles are about package cohesion, they tell us what to put inside packages: The granule of reuse is the granule of release Classes that change together are packaged together Classes that are used together are packaged together So, answering your question, who/what is going ...


-2

First of all, UUID (with uppercase) seems like a very bad idea for the package name or class name to me, from all the styles enforced one way or another all uppercase names are associated with the "constants". Packages are intended to organise stuff, the easiest way to name a package is by the value of the classes that it holds: you may choose to separate ...


1

Purpose of packages is to group classes according to some criteria (package by type/layer vs. package by feature etc.). I don't really see a point to create package for just one class - especially if you don't expect there will be other classes in this package in the future. Also I think that "util" package name is not totally meaningless - it just groups ...


10

The problem with trying to put each class in a package which has a semantically correct name for that class is that it tends to lead to packages that contain very few classes, or sometimes even just one class. This in turn leads to a multitude of packages. A more pragmatic approach to package naming is to simply help you find stuff. Keeping frequently ...


1

So far nobody in this question seems to have picked up on the real reason for this naming convention. A DirectoryInfo is not the directory. It is a DTO with data about the directory. There can be many such instances describing the same directory. It is not an entity. It is a throw-away value object. A DirectoryInfo does not represent the actual directory. ...


1

ThingInfo can serve as a great read only Proxy for the Thing. see http://www.dofactory.com/net/proxy-design-pattern Proxy: "Provide a surrogate or placeholder for another object to control access to it." Typically the ThingInfo will have public properties with no setters. These classes and the methods on the class are safe to use and will not commit any ...


9

In Scala, this is called a sliding window: Seq(1, 2, 3, 4, 5).sliding(2).foreach(println) // List(1, 2) // List(2, 3) // List(3, 4) // List(4, 5) As opposed to grouped when the elements don't overlap: Seq(1, 2, 3, 4, 5).grouped(2).foreach(println) // List(1, 2) // List(3, 4) // List(5) In Ruby, it is called cons: [1, 2, 3, 4, 5].each_cons(2).to_a # ...


5

A tuple is a finite sequence (ordered list) of elements. It's true in mathematics, relational databases and many languages (e.g. C++, Prolog, Python...). So tuple could be a good name. node is an alternative since an object of the form {prev, curr, next} remembers of a node of a doubly linked list.


17

Apart from triple (which only means "we have three values") and node (which has been suggested by manlio), I can suggest the following alternatives: Sliding window It looks like you always have a window of three consecutives elements in the list. This is the most appropriate name IMHO according to your situation. That structure does not allow to easily ...


-3

Well this seems like a theory question on algorithms and datastructures. As for the datastructure, if you want to return the three results at once, of course you need to put them into one datastructure, and of course that would make it a triple. Without a given syntax it's hard to give an answer and the question seems not properly stated, I feel the ...


0

Here's a simple overview: Control refers to what the program does next On the top level, there are typically two things that control the control: the application itself and the user In the olden days, control was owned by the application first and the user second. If the application needed something from the user, it would stop and ask and then move on ...


0

If your class just routes messages call it 'MessageRouter'. The TCPClient dependency should be abstracted to an IClient interface which you should inject into the routing class via a constructor parameter. Thus the TCPClient implementation shouldn't affect the naming of the MessageRouter, because it could work equally well with HTTPClient or whatever. ...


2

I would say that context/domain matters, since we have high level business logic code and low level models, architecture components and so on... 'Info', 'Data', 'Manager', 'Object', 'Class', 'Model', 'Controller' etc. can be smelly suffixes, especially on a lower level, since every object has some information or data, so that information is not necessary. ...


2

Considering the actual devices (sensors and receivers) are one thing, and their representation in software is another, I am thinking about naming some classes with the "Info" suffix name pattern. For example, while a Sensor would be a class to represent the actual sensor (when it is actually connected to some working device), SensorInfo would be used ...


2

In general, an Info object encapsulates information about an object's state at some moment in time. If I ask the system to look at a file and give me a FileInfo object associated with its size, I would expect that object to report the size of the file at the time the request was given (or, to be more precise, the size of the file at some moment between when ...


15

I think "info" is a misnomer. Objects have state and actions: "info" is just another name for "state" which is already baked into OOP. What are you really trying to model here? You need an object that represents the hardware in software so other code can use it. That is easy to say but as you found out, there is more to it than that. "Representing ...


10

It may be a little difficult to find a single unifying convention here because these classes are spread out over a number of namespaces, (ConnectionInfoseems to be in CrystalDecisions, and DeviceInfo in System.Reporting.WebForms). Looking at these examples, though, there seem to be two distinct uses of the suffix: Distinguishing a class providing static ...


2

I wouldn't call this refactoring, as it adds functionality (you can now have other numbers of labels per page). Refactoring is making changes to the code without changing the functionality. What you are doing is adding a layer of abstraction. Maybe multiple layers, it depends on how you like to count these things -- the Label classes and their machinery are ...


2

Martin Fowler (author of the book "Refactoring") would probably do this in more than one step. These steps could be, for example, Replace Magic Number with Symbolic Constant" to replace 4 by a symbol LabelsPerPage, then Add Parameter to replace the constant by a parameter of the method where it is used. Later, Replace Parameter with Method could be the first ...


4

Often among my friends we would call this softcoding. It's a play on words to imply the opposite of hardcoding and has the nice advantage that it's recognizable for most programmers. More technically, if I were to describe it in documentation it would simply be "making the software more configurable" or variations of such. In math related software I ...


2

The antipattern is usually called magic numbers, but the refactoring doesn't have quite such a well-known name. My IDE calls the process of turning literals into parameters externalizing (e.g. "Externalize Strings").


2

Requiring that getX methods always correspond to a field breaks encapsulation. That the field exists at all is private information of the class, something no other class should rely on. Maybe you want to change to a different implementation some day. On the other hand, the getX method is a public interface. If it implied the existence of a field, would it ...


5

Let's say you're writing a GUI control, and you want to be able to resize it. Intuitively, you should have a setHeight method and a setWidth method for the dimensions. These should set a value on the control, but if they don't also cause the control to recalculate and redraw itself, you're violating the heck out of POLS, because your user is going to ...



Top 50 recent answers are included