Hello,
After some days of intensive work I have YAF 1.9.4 integrated in my portal at 90%.
And my constatation is that amongst the large part of good ideas and features some dev choices seem to slow down YAF in 1.9.4 and limit its portability.
I have to struggle with a pratice spread amongst code: reflexion.This is slowing down code and limiting choice of integration to the Web Site model.
Unfortunately I was needing a Web Applcation model and when I converted code, lot of internal process stop working because they were build on the assertion that assemblies where generated on the fly.
For exemple I loosed the list of html editors because it was implemented using reflexion with code like this
YafEditorModuleManager()
: base("YAF.Editors", "YAF.Editors.IBaseEditorModule")
{
if ( ModuleClassTypes == null )
{
// re-add these modules...
base.AddModules( BuildManager.CodeAssemblies);
}
}
BuildManager is very slow and no more gives the correct assemblies when App_Code has diseappeared.
Here, it would have been better to simply have a static list with editors modules present in the code.
Reflexion is a beautifull and 'sexy' concept bring out by .net, but very very slow and for Web App it is clearly not a choice.
Activator.CreateInstance should be reserved for special conditions, when you can't have a select with a new for each different case.
I must add that without documentation, the YAF code is especially uneasy to read due to this practice.
Second point the Ajax/JQuery features.My portal code uses Microsoft Ajax and the main page is automatically loading JQuery, it seems that when I load YAF as a control in my module, it load again JQuery, eventually with a different version (I will check this).
Pages take some 10 seconds to load in totallity from a local server, one user, one topic, one forum... and I have often javascript errors detected by IE8 (and I don't speak of IE6....), I have not tested with FireFox or Chrome.
In YAF, JQuery is bring by DNA libraries, their controls seem good but will they be enough portable and extensible to support current evolutions of .Net versus JQuery. I don't think.
I admit the problem is not simple fo an open source software.
To limit problem, there should be some way to say : 'Hey the JQuery is already loaded by Ajax.net, don't send it again to page and uses the already loaded version'
Last Point: using YAF under another PortalThis is done by a direct code hard modifications, just as in this method
static public IUrlBuilder UrlBuilder
{
get
{
if ( HttpContext.Current.Application[UrlBuilderKeyName] == null )
{
string urlAssembly;
if ( IsRainbow )
{
urlAssembly = "yaf_rainbow.RainbowUrlBuilder,yaf_rainbow";
}
else if ( IsDotNetNuke )
{
urlAssembly = "YAF.Classes.DotNetNukeUrlBuilder,YAF.Classes.Utils";
}
else if ( IsMojoPortal )
{
urlAssembly = "yaf_mojo.MojoPortalUrlBuilder,yaf_mojo";
}
else if ( IsPortal )
{
urlAssembly = "Portal.UrlBuilder,Portal";
}
else if ( IsPortalomatic )
{
urlAssembly = "Portalomatic.NET.Utils.URLBuilder,Portalomatic.NET.Utils";
}
else if ( EnableURLRewriting )
{
urlAssembly = "YAF.Classes.RewriteUrlBuilder,YAF.Classes.Utils";
}
else
{
urlAssembly = "YAF.Classes.UrlBuilder";
}
HttpContext.Current.Application[UrlBuilderKeyName] = Activator.CreateInstance( Type.GetType( urlAssembly ) );
}
return (IUrlBuilder)HttpContext.Current.Application[UrlBuilderKeyName];
}
}
}
or this one
protected static string TreatPathStr( string altRoot )
{
string _path = string.Empty;
try
{
_path = HttpContext.Current.Request.ApplicationPath;
if ( !_path.EndsWith( "/" ) ) _path += "/";
if ( !String.IsNullOrEmpty( altRoot ) )
{
// use specified root
_path = altRoot;
if ( _path.StartsWith( "~" ) )
{
// transform with application path...
_path = _path.Replace( "~", HttpContext.Current.Request.ApplicationPath );
}
if ( _path[0] != '/' ) _path = _path.Insert( 0, "/" );
}
else if ( Config.IsDotNetNuke )
{
_path += "DesktopModules/YetAnotherForumDotNet/";
}
else if ( Config.IsRainbow )
{
_path += "DesktopModules/Forum/";
}
else if ( Config.IsPortal )
{
_path += "Modules/Forum/";
}
if ( !_path.EndsWith( "/" ) ) _path += "/";
// remove redundant slashes...
while ( _path.Contains( "//" ) )
{
_path = _path.Replace( "//", "/" );
}
}
catch ( Exception )
{
_path = "/";
}
return _path;
}
This could be easily remplaced by a general HostingPortal Provider that we could parameter from Web.config rather than doing direct code change always prone to errors and portability.
I think that decision should be taken to change actual orientation in 1.9.4 for these 3 points.
These concerns are only a small part of YAF code which remain a solid foundation for a Forum tool.
Thanks for attention.
CS