Are there performance issues related to: returning data to a UI layer from a BLL layer via a method's "out" parameter (i.e., using "Void" as the method's return type and return any data via parameters as seen in below example)?
For example:
//ASPX.CS Code-Behind Class File
private void GetGradeData(out List<GradesDTO> data, out decimal median)
{
//UI Method Signature - Call to BLL
Grade.Get_ClassGrades(navigation.SchoolID, navigation.CourseID, out data, out median);
}
***********************************************************************************
Public Class Grade
{
//BLL Method signature
public void Get_ClassGrades(long schoolId, long courseID, out List<GradesDTO> GradesData, out decimal MedianScore)
{
// Method body
}
}
Is it in any way recommended or not recommended practice to do something like the above method calling using the "out" parameter OR is it just fine and can be considered the same in terms of performance (in a layered web application - UI - BLL - DAL) when compared
to objects interacting in which each has its own method with return types identified (i.e., same behavior as in code above but do not use "out" parameters but define a method's return type; thus not using "void") at the method signature level?
In short, is the above code samples the same performance wise as one using a method level return type instead of using "out" params?
Any input that you can give with respect to each or both as best practice or performance penalties would be greatly appreciated. Thank you.
-
-
I can't say what the rest of the world thinks but here are a few things I would say:
I would make that a function that looks like a classic function, that way it's use is clear
//ASPX.CS Code-Behind Class File
protected GradeResults GetGradeData( int SchoolID, int CourseID )
{
GradeResults Results = new GradeResults();
//UI Method Signature - Call to BLL
Grade.Get_ClassGrades(SchoolID, CourseID, out Results.data, out Results.median);
}
or something like that.... so that the function takes params and returns data/ results
imho having "magic" values appear inside a function/method is not a good thing, in a large system you can lose track of that outside item and not make it easy for a later person to see what you are doing/ how you are getting the parameters that drive that function.
just my thoughts, possibly very wrong etc... -
Wrap SchoolID/CourseID/Median/Data in a class? They look related...
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.