Return to site

😁 Easy Peasy homework and computer science professor 😔

· joke
broken image

😁 Easy Peasy homework and computer science professor 😔

Teacher: Write code to sort an array.

Student: 

Arrays.sort(array);

Teacher: So deceitful...

The teacher was not impressed by the student's answer. He expected him to write his sorting algorithm, not use the built-in method of the Arrays class. He decided to teach him a lesson.

Teacher: Very clever, but not enough. Now write code to sort an array of strings in reverse alphabetical order.

Student: 

Arrays.sort(array, Collections.reverseOrder());

Teacher: Still cheating. How about sorting an array of objects by a custom comparator?

Student: Arrays.sort(array, (o1, o2) -> o1.compareTo(o2));

Teacher: Enough! You are not learning anything by using these shortcuts. You need to understand the logic behind sorting, not just memorize the syntax. Go back and write your code from scratch, or you will fail this assignment.

Student: But sir, why reinvent the wheel when there is already a perfectly good solution available? I am just being efficient and pragmatic. Isn't that what programming is all about?

Teacher: No, programming is also about creativity and problem-solving. You can't rely on existing methods for everything. You need to develop your skills and knowledge. Besides, what if you encounter a situation where the Arrays class is not available, or the sorting method is not suitable for your needs? What will you do then?

Student: I guess I will google it.

Teacher: So deceitful...