c++ - Aspect Orientated Programming in Qt -
I am trying to get my head around AOP and some QT codes will really help.
Here is some sample code (easy to read QT / C ++ programmer):
zero transfer (account AACC, account to AACC, int amount , User user, logger logger) throws an exception {logger Information ("fund transfer ..."); If (Check User Promotion (User)) {logger.info ("user is not allowed."); Throw new unauthorized user concept (); } If (fromAcc.getBalance () & lt; zodiac) {logger.info ("Insufficient fund, sorry :("); New inadequate funds exception ();} SACC method (amount); toAcc.deposit (amount) ; // Get database connection // save transaction logger.info ("successful transaction. :)"); }
and then "Attached":
Exceptions to zero transfer (account, account to AACC, int.) From account (if (fromAcc. GetBalance () & lt; zodiac} {new impaired funds extinguish ();} SACC method (zodiac); toAcc.deposit (amount);} Aspect logger {Zero bank transfers (AACC, account to AACC, int amounts, users User, logger logger) account {logger.info ("transfer money ...");} Void Bank.getMoneyBack (user user, int transaction ID , Logger Logger) {logger.info ("Money Backed by User Requested");} // Other Crosking Code ...}
QT signals and slots for decoding objects
So: Can it be done with QT or do I need some special settings / preprocessors referred to in the Wikipedia article?
I'm guessing that Qt After using the Meta object compiler, there should be some tricks and Some of the functionality can be "injected", which with dynamic methods ... just spit-bowling;)
Edit : To give a better context: I really Like the dynamic aspects of the Qt meta object with the signal and slot, and would like to feel it Qt, I think that using slots (or hints) as a point reduction For example:
If I use the slot bank A: Transfer (...)
and then indicate the bank: OnBeforeTranfer ()
and SIGN Bank :: ONEFTER TRANSFER ()
. If I connect them to other aspects, then security :: transfer ()
and logger :: transfer ()
(all the query object) I can block calls (eg That on-banner transfer failed).
But if we take it for less and get cleaner code in next development then I can get rid of the signal from OnXXXX
I bank :: transfer ::
security :: transfer
slot and logger :: transfer
. Anything dynamic in QT? : Like the order to call the slots and stop the next call in the " slot series "?
This entire context can still be assumed to be AOP? Am I trying to stick to "method level point reduction" or am I next to the point here?
In which language are you planning to use Qt? I recently had to create a simple GUI in the queue around a Python script and AOP Python package was used to do some quick before and after the luggage. QT is incident-based programming, I would say that being familiar with QT basics, many things are similar to AOP-style operation and then search for some AOP libraries for that language, which you plan to use in QT.
Comments
Post a Comment