Skip navigation
 

Gradebook
Added by George Kroner, last edited by Paul Monk on 15 Dec 2007 01:40 PM
(None)

Gradebook

GradeBookSDK? Tips

1. Improving the performance using bulk methods

Often when developers think of update grades or retrieve grades, they think of processing records one at a time.

for (int i = 0; i < students.length; i++)
{
    // some logic to get all grades of the student 
    for (int j = 0; j < studentGrades.length; j++) {
        MemberAttrValueVO memberValue = new MemberAttrValueVO();     
        
        // some logic to get student grade and set up the memberValue object...
        
        gradeBookSDK.setMemberValue(session, sectionId, memberValue);   
    }
}


It's of course true that we have to process records one at time, However, it may not be the best practice when we deal with web service calls.  Each web service call associates with overheads like translating method call to SOAP, set up network connection, and process SOAP on the server end. When we are updating hundreds of records, the overhead could cumulate and impact the performance .

To reduce the overhead, we could consider using bulk processing methods provided by GradeBookSDK?. For instance, GradeBookSDK?.setMemberValues() method can be used to set multiple column values for multiple users at once. Eg:

MemberAttrValueVO[] memberValues = new MemberAttrValueVO[students.length * numberOfColumns];
for (int i = 0; i < students.length; i++) {
    for (int j = 0; j < numberOfColumns; j++) {
        memberValues[i*numberOfColumns + j] = new MemberAttrValueVO();
        
        // some logic to get student grade and set up the memberValues[] element...
    }
}
gradeBookSDK.setMemberValues(session, sectionId, memberValues);

One good thing about the setMemberValues() method is that it's not limited to one function call per student, or per column. Since memberAttrValueVO object contains the memberId and columnId information, the memberAttrValueVO[] can hold the grade info from any column for any user.  So if we have 100 students in a course and each has 3 column values to update, we can create a memberAttrValueVO[] of 300 elements and update all values in one single web service call.  This way, we limit the web service overhead by reducing the number web service calls.

There are a lot of bulk processing methods in GradeBookSDK? that could be used improve the performance. They are:

Method name Purpose
getAllMemberAttrValues(session, sectionId, sectionColumnId) Retrieve the grade info from given column for all students in the section
getMemberAttrValues(session, sectionId, memberIds, sectionColumnId) Retrieve the grade info from given column for all students given in the memberIds array
getMemberGradeValues(session, sectionId, memberId, sectionColumnIds) Retrieve the grade info from columns given in sectionColumnIds for one given student
setMemberValues(session, sectionId, memberValues) Set all grade info defined in the memberValues array

Keep in mind that there could be performance bottlenecks for transferring large array list over web services, but we don't expect big problems with a few hundred grades.

Adaptavist Theme Builder Powered by Atlassian Confluence

By accessing the Knowledge Base, you agree to the following: Blackboard makes no representations or warranties as to the accuracy of any information in the Knowledge Base. Blackboard is not responsible in any way for information provided to the Knowledge Base by third parties. Information in the Knowledge Base is not documentation for any Blackboard product. Nothing in the Knowledge Base shall be deemed to modify your license in any way to any Blackboard product. Blackboard reserves the right to use your name and the name of your institution in reference to any information submitted by you to the Knowledge Base. Blackboard may modify, distribute, republish in any format, delete, incorporate or use in any way the information that you contribute to the Knowledge Base.