Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Skylark OO (reposted from PM)
Skylark OO (reposted from PM) [message #39717] Sat, 20 April 2013 14:37 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hello Mirek,

Do you have any plans to make Skylark object orientated? And maybe using MVC?
If you know CakePHP, object orientated in that direction, using components, elements, helpers, etc.

I've tried something in that direction, but i've hit procedural design of skylark.

#define SKYLARK_C(klass, method, path)\
INITBLOCK {\
	klass obj;\
	UPP::RegisterHandler(callback(&obj, &klass::method), #klass"_"#method, path);\
}

SKYLARK_C(Test, test, "")
SKYLARK_C(Test, user, "user")

That works, but has the requirement to have Http& as parameter to each class method. Another problem is when trying to route to same method (i.e SKYLARK_C(Test, user, "super/user") ). I think id should not be tied with route and object (or function), i should find another solution and allow different routes to same method. Current implementation doesn't allow that too, but would be possible to create a new function which share code.
IMO Skylark is too procedural, loosing what language has to offer . Maybe it was designed for file to be considered as object and SKYLARK() as it's methods?
Example:
// User.icpp
// shared code here
int something = 10;
void doSomething() {}
// end shared code
SKYLARK(UserLogin, "user/login")
{
    doSomething();
    // and something else
}
SKYLARK(UserLogout", "user/logout")
{
    doSomething();
}


I'm wondering where should i put the code to know if user is authenticated and if some method is allowed for current user. Should that be in each method?
In an OO design, class would have virtual method beforeAction (or some other name) which would make possible to skip processing of code if it would return false, or maybe call some other method of class, and call view render earlier.
I would like to use skylark, but right now i don't see it as being practical.
Also there are problems when javascript code is inlined in template. I.e.:
<script type="text/javascript">
$("#test").button();
</script>

get converted to
<script type="text/javascript">
#test.button();
</script>

Should i escape it somehow?

Best regards,
Andrei
 
Read Message
Read Message
Previous Topic: Is there a Threadpool in U++?
Next Topic: Skylark and GUI in one app - need some advices
Goto Forum:
  


Current Time: Sun May 05 16:39:05 CEST 2024

Total time taken to generate the page: 0.02626 seconds