Saturday 15 June 2013

flash - What's the reason for interface to exist in Actionscript-3 and other languages -


What does this interface mean? Even if we apply an interface to a class, we have to re-declare its functionality every time we implement it in a different class, so what is the interface of the interface or interface in another language thanks < /p>

I agree with the answers originally posted so far, just a little bit to add.

To answer the easiest answer, yes, there are interfaces in other languages. Java comes to mind immediately, but I'm pretty sure that to create an interface in all OOP languages ​​(C ++, C # etc) There are some mechanisms involved.

As Jake has said, you can write the interface in the form of "contracts". What will be accomplished to separate the work. To say a fiction that I am working on A and You are working on C, and working on Bob B. If we define B as the interface for B, then we can define B quickly and relatively easily. B, Implementation), and all go on our way. I can assume that A to B can be a code, you can get it from C. You can code B, and when done with Bob B, we can simply plug it.

This Jugg1es point. The ability to swap the entire functional piece has been made easier by "dependency injection" (if you do not know this phrase, please Google). That's right, you create an interface that usually defines what will happen, say a database connector. For all database connectors, you want to be able to connect it to the database, and run the query, so that you can define an interface that says that the class "connect ()" method and a "duke (stringing) ) "Should be. Now, Bob explains that the MySQL writes the implementation for the database, now your customer says that we only pay 200,000 for new servers and they will run Microsoft SQL so that you can take advantage of it with your software Databases connector is needed.

In real life, I have a friend who runs meat packing / distribution company in Chicago. The companies that have created their software / hardware setup for scanning packages, and telling things for weight and exchange, that they have to upgrade to new OS / server and new hardware to keep them with software. Modularly not written, allowing them to maintain the rear compatibility. I have been in this boat long ago, telling someone that XYZ needs to upgrade to get ABC functionality which will make my job easier by 90%, in any way, in the real world, guess People do not always use these things and it can cut you in the ass.

No comments:

Post a Comment