In OOP, what is the name of the process that turns something that is not explicitly an entity in the application domain into a class? I had that word, but I forgot it and google is not helping. For example, the Strategy in the "Strategy pattern", that doesn't immediately seem to be a class
Found it! I still have to remember the source of this knowledge, but here it is
http://en.wikipedia.org/wiki/Reification_(computer_science)
Related
I have a direct question: Is a good pratice use Singleton pattern to control a class responsable for Login tasks, or another pattern is more appropriated? Or do not exist a patter to do this kind os issue?
Thanks.
Few people use singletons these days as they are almost becoming anti-patterns. I would recommend to learn Dependency Injection (DI).
With DI you can register the object you wish to use as singleton with a container and that container will serve or give that object to all other objects that need it. Of course you can register the object as a singleton - but not the usual singleton - and the container will guarantee that all objects which need it will receive the same instance.
Nevertheless, if you are building a small application then It would be better to use the Singleton pattern and avoid DI.
Jon Skeet has a very nice article about Singleton pattern or if you are using Java then you could use Enumerations to implement it, look implementations techniques on Google.
The singleton pattern is used when you have to prevent the creation of more than one instance of the same class. I do not really see the situation in which a login class should only have one instance so i would say using this pattern for a login class is overkill.
Then again, introducing a DI framework when you only need a simple singleton... now thats overkill :)
Yes and no. There's no 'best' or 'worse' practise.
Just do it, if using a singleton makes it easier to test and if the approach will get you to the pub earlier than learning and implementing DI just for the purposes of login.
In cases of MVC applications where the model is split into separate domain and mapper layers, why would you give each of the mapper classes its own interface?
I have seen a few examples now, some from well respected developers such as the case with this blog, http://site.svn.dasprids.de/trunk/application/modules/blog/models/
I suspect that its because the developers are expecting the code to be re-used by others who may have their own back-ends. Is this the case? Or am I missing something?
Note that in the examples I have seen, developers are not necessarily creating interfaces for the domain objects.
Since interfaces are contracts between classes (I'm kinda assuming that you already know that). When a class expects you to pass an object with as specific interface, the goal is to inform you, that this class instance expect specific method to be executable on said object.
The only case that i can think of, when having a defined interface for data mappers make sense might be when using unit of work to manage the persistence. But even then it would make more sense to simply inject a factory, that can create data mappers.
TL;DR: someone's been overdoing.
P.S.: it is quite possible, that I am completely wrong about this one, since I'm a bit biased on the subject - my mappers contain only 3 (+constructor) public methods: fetch(), store() and remove() .. though names method names tend to change. I prefer to take the retrieval conditions from domain object, as described here.
I have only ever seen it being used to 'overcome' the diferences between OOP and SOA.
I don't think it's a hack. The only thing that doesn't really sit right with me is that you have to attach the attribute to the base class when using inheritance to tell it what types are derived from it. This is a bit upsidedown but can be done programatically so it's not the end of the world.
It's a mechanism allowing the serializer to be informed of all types used by this web service so that they are correctly emitted in the WSDL and known by the clients. So consider it whatever you want: hack, feature, ... I consider it as a way to make the clients know all possible types.
Given the fact that I have a fully dynamic object model, that is, I have no concrete classes defined anywhere in code, but I still want to be able to create WCF DataContracts for them so I can use them in operations. How can I achieve this?
My concrete class "Entity" implements ICustomTypeDescriptor which is used to present the various properties to the outside world, but my expeimentation with WCF suggests that WCF does not care about ICustomTypeDescriptor. Is this correct or have I missed something?
Is this possible? It cannot be so that the only way to create a DataContract is to actually have a concrete harcoded class, can it?
you may use untyped service and message contract IIRC http://geekswithblogs.net/claeyskurt/archive/2008/09/24/125430.aspx
You might try System.Reflection.Emit.
Its quite tricky, but essentially you will just build a custom run-time type, with decorated data contract attributes. It gets tricky when creating encapsulated properties with PropertyChanged notifications, but in your service layer you can just get away with auto properties which are a lot easier.
This dated, but still very relevant link should get you going in the right direction.
http://drdobbs.com/184416570
Things evolve :-) Thanks to the excellent blog series by Alex D James its very easy to implement this.
Is there a name meaning "not a singleton"?
Castle Windsor uses the term "transient" to describe all non-Singleton objects.
I personally prefer the term "non-Singleton" though.
Yes, there is a Multiton pattern, but it means something very specific. It's not simply everything that's not a Singleton.
Prototype.
It is used as a scope in Spring framework to identify dependency which will always be new instance when injected.
When someone asks me if a class is a Singleton (and it isn't), I just say no, it's a regular class.
Multi-Instance ?
http://elegantcode.com/2008/04/17/the-opposite-of-a-singleton/
Actually, there is a variant on the Singleton called Multiton or Multiplton or something like that. Rather than having one instance, you have n instances where n is a specific value. I'm not sure if the Gang of Four describe this application in their book, but I learned about it in my Software Engineering 361 class.
But if you have an unconstrained number of instances, I don't think there is a name for it.
Simply, a 'Single Instance of a Class.'
This is an old post, but if someone still comes across then a better word is "multiplex" over "transient". IMHO
Definition:
noun:
a system or signal involving simultaneous transmission of several messages along a single channel of communication.
There is a related thread about this over at English Language & Usage. Looking through the various suggestions posted there, I think the best one is
replicant
I've adopted this term in the naming of methods and the wording of comments in a little PHP Reflection factory I've built.
How about the word "Instanced"