Looking at the inheritance diagram on the API, I noticed that MPxSelectionContext has this template class.
From what I read, If I were to have, multiple manipulators and wanted to use the same context, I could use a template class to reuse my code over different manipulators, is that use correct?
Are there other differences or advantages of using a template class?
Not all MPx classes have a template class equivalent, why is that?
Here's an API example.
Thanks for reading me.
Related
I have a couple of questions related to inheritance in Windows Runtime Components authored using C++/WinRT. Firstly why is there a restriction that classes, if they have a base class, must have ultimately derive from a class in the Windows.* namespace?
Secondly, what is the best way to work around this. In fact I don't really want consumers to be able to derive from my class, but I'd like to derive from a base class in the implementation in order not to rewrite code. At the moment my implementation class is a lightweight wrapper around a standard C++ class that uses standard C++ inheritance. But is there a way to simplify this? Can a list one implementation class as the base class of another? I am mainly familiar with C# where multiple inheritance is not possible, so am not sure about this sort of thing.
Any runtime class (that you declare in your application) that derives from a base class is known as a composable class. The ultimate base class of a composable class must be a type originating in a Windows.* namespace;.
And if you want to inherit custom runtimeclass, the Windows App Certification Kit tests will produce errors. From this thread, it seems that you can only declare a C++ native class and implement the interfaces. Let the implementation classes inherit from it.
I started learning the dart language. when I heard the term Helper Class. I didn't get any clear answer.
Please tell me about
What is the meaning of the Helper Class?
For which purpose they are used
Thank you so much to the kind community. :)
In simple words Helper class is like a warehouse where you can put commonly used operations for other classes. So whenever other classes will need them they can access them.
Imagine you have some code which is commonly used in your app. So there are two ways to use that code.
To write the same code again and again. (Which no one wants and prefers)
To put that code somewhere and call it whenever you need it. And this is a situation where helper class come in to play.
Below are some main objectives behind its creation:
A helper class is created to make code more readable and clearly organizable.
They help to eliminate boilerplate code as they contain commonly used functionalities.
The other goal behind its creation is to provide a common functionality to other classes. In helper class, you can move some methods, variables, and operations, which are commonly used in other classes. So it helps to make your code more organized, maintainable and readable to others.
I hope it helps you. :)
PropertyVersionBase has been marked obsolete for a long while.
Currently, it's the only way to maintain a reference to either Template or DictionaryTemplate, or to either WellLogVersion or DictionaryWellLogVersion, etc.
The confusion with PropertyVersion[Base] is that it was also the base class for e.g. *WellLogVersion, which are fundamentally different from Template classes - a controversial design decision (IMHO) early on in Ocean.
I would appreciate some clarification:
Will this base class eventually be removed?
Will there be a base class for Template and DictionaryTemplate?
Will there be a base class for WellLogVersion and DictionaryWellLogVersion?
In general, where is these class hierarchies going in the future?
(I'd like to tag on a second question: could any base class also expose Droid, pretty please?)
PropertyVersionBase was marked obsolete in 2012.1, but DictionaryPropertyVersion was missed (it was only deprecated in 2012.2). So due to the Ocean stability promise we will keep both in 2013.1 and remove them in 2014.1.
There was no plan for base classes so far (Object is the common replacement base). But we may consider to add specific base classes for 2014.1. This would simplify some of our APIs too where the attached template can be dictionary or continuous template.
Thanks for the suggestion.
Best Regards,
Gaelle
I just want advice on whether I could improve structure around a particular class which handles all disk access functions
The structure of my program is that I have a class called Disk which gets data from flatfiles and databases on a, you guessed it, hard disk drive. I have functions like
LoadTextFileToStringList,
WriteStringToTextFile,
DeleteLineInTextFile
etc
which are kind of "generic methods"
In the same class I also have some more specific methods such as GetXFromDisk where X might be a particular field in a database table/query.
Should I separate out the generic methods from the specialised. Should I make another class which inherits the generic methods. At the moment my class is static as there is no need to have an internal state of the class.
I'm not really OOPing am I?
Thanks
Thomas
If you are using only static static functions you are not really OOPing as you said. It is writing procedural code in OO language.
You should look to create classes which represent objects in your problem domain like File and TextFile. These classes should have operations like DeleteLine, WriteLIne, Load etc.
Also, in which ever language you are programming, it is likely to have a good File IO library. Try to use that in your code as much as possible. If needed just write wrappers over the library classes to provide some additional functionality.
Well, what you seem to have in your code is a Utilities class where you bundle in all the file methods.
This could indicate some design issue but IMHO it is ok, since it is common to have utility classes in OOP designs.
It haves the benefit of being able to add extra methods or modify existing ones easy since you will not have any derived classes extending the Utility class to be affected.
For example java has static methods everywhere. E.g. Collection class.
I would suggest to have the class's contructor be private and have the naming such that is obvious that this is a Utilities class.
I remember back when MS released a forum sample application, the design of the application was like this:
/Classes/User.cs
/Classes/Post.cs
...
/Users.cs
/Posts.cs
So the classes folder had just the class i.e. properties and getters/setters.
The Users.cs, Post.cs, etc. have the actual methods that access the Data Access Layer, so Posts.cs might look like:
public class Posts
{
public static Post GetPostByID(int postID)
{
SqlDataProvider dp = new SqlDataProvider();
return dp.GetPostByID(postID);
}
}
Another more traditional route would be to put all of the methods in Posts.cs into the class definition also (Post.cs).
Splitting things into 2 files makes it much more procedural doesn't it?
Isn't this breaking OOP rules since it is taking the behavior out of the class and putting it into another class definition?
If every method is just a static call straight to the data source, then the "Posts" class is really a Factory. You could certainly put the static methods in "Posts" into the "Post" class (this is how CSLA works), but they are still factory methods.
I would say that a more modern and accurate name for the "Posts" class would be "PostFactory" (assuming that all it has is static methods).
I guess I wouldn't say this is a "procedural" approach necessarily -- it's just a misleading name, you would assume in the modern OO world that a "Posts" object would be stateful and provide methods to manipulate and manage a set of "Post" objects.
Well it depends where and how you define your separation of concerns. If you put the code to populate the Post in the Post class, then your Business Layer is interceded with Data Access Code, and vice versa.
To me it makes sense to do the data fetching and populating outside the actual domain object, and let the domain object be responsible for using the data.
Are you sure the classes aren't partial classes. In which case they really aren't two classes, just a single class spread across multiple files for better readability.
Based on your code snippet, Posts is primarily a class of static helper methods. Posts is not the same object as Post. Instead of Posts, a better name might be PostManager or PostHelper. If you think of it that way, it may help you understand why they broke it out that way.
This is also an important step for a decoupling (or loosely coupling) you applications.
What's anti-OOP or pro-OOP depends entirely on the functionality of the software and what's needed to make it work.