get_first_professor_by_school_and_name functions like get_professor_by_school_and_name, except it does not check the professors' number of ratings. Instead, it returns the first professor in its search results that a Professor object can be created for.
As it doesn't require rating data, it doesn't need to create a Professor object for every single professor in its search results, therefore increasing performance by making less requests to RMP :DDD
Also, it is useful for when the developer wants to trust RMP's search algorithm, and may not strictly only want the professor with the most ratings.
It duplicates a lot of get_professors_by_school_and_name's code, which slightly sucks, but I also am not sure how else to do things without also sacrificing code readability or losing the performance benefits.
get_first_professor_by_school_and_name
functions likeget_professor_by_school_and_name
, except it does not check the professors' number of ratings. Instead, it returns the first professor in its search results that aProfessor
object can be created for.As it doesn't require rating data, it doesn't need to create a
Professor
object for every single professor in its search results, therefore increasing performance by making less requests to RMP :DDDAlso, it is useful for when the developer wants to trust RMP's search algorithm, and may not strictly only want the professor with the most ratings.
It duplicates a lot of
get_professors_by_school_and_name
's code, which slightly sucks, but I also am not sure how else to do things without also sacrificing code readability or losing the performance benefits.