Rate Thread
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting D in class
#1
Soo I thought this may give you all a chuckle, especially the programming savvy though I moved the technical details to the end.

So our professor was being a braniack and demonstrating how his code example was super efficient.

*He is actually a genius*

In short he used a pattern called decorator, it acts similarly to an LinkedList.



So he drew a diagram on the board of about 8 objects and abbreviated the getData() as "getD" and used psuedocode for explaining purposes.

and was like
"OK class, we will start out here at the outermost object and we will work our way to the center. So the first thing we will do is getD."

*some snickering occurring behind me*

"then we will move further in and getD"

*I get it at this point and try and hide a smile*

"So, Alex what will we do here?"

*"getD, sir"*

"thats right we getD"

*at this point my friend jonathan behind me cracks up, trying not to burst out laughing he triest to wrap his face in his arms, this causes me to nearly loose it*

and through the next approximatly 5 objects the teacher pauses and repeats and "here again we getD"

*im almost in tears and the rest of the class is trying their best to maintain composure, every time the teacher says getD its like a slap in the face!*

It crosses my mind, in one class period we got more d than a group of gay guys doing a gay pubcrawl at a pride parade.

ugh it hurt soo bad, then my desk was freaking shakeing because johnathan was physically vibrating trying to prevent a outburst of laughing. The teacher had his back to us and I started to slip outa the room but I realized we had 2 objects left to getD, so I started drawing random crap on my paper and doing math in my head trying to distract myself.

AAANNYY way just thought you guys may get a smile outa our cs class getting soo much d Wink

//**********************************************boreing details
Each class inherits from an abstract item class then each class stores the next class in sequence as a field. IE
Item item; //much like Node node;
double value;


One thing they also share is a getData() method.
so when one class does this
public double getData(){
return this.item.getData()+this.value;}

all items effectively walk a list that delegates responsibility onto the next object
its super efficient because imagine a store with 10,000 items.
the cashier can scan something say (pencil) that value passes into a switch or something until pencil is found and retuns a numerical value based on cost.

if you purchase items p, and the store has some ammount of items i then the time complexity is O(p*i)
doing what the professor did is simply O(p) //much much less!
simply makeing an abstract class with default methods and fields each item in the store can inherit the item class and even though each item has its own class the code is really short since your useing extends.
//*****************************************end boreing details
Reply



Messages In This Thread
Getting D in class - by SilverBullet - 12-03-2016, 11:22 PM
Getting D in class - by InbetweenDreams - 12-04-2016, 03:11 AM
Getting D in class - by Camfer - 12-04-2016, 04:53 AM
Getting D in class - by kindy64 - 12-04-2016, 05:54 AM
Getting D in class - by kindy64 - 12-04-2016, 05:56 AM
Getting D in class - by SilverBullet - 12-04-2016, 11:47 AM
Getting D in class - by InbetweenDreams - 12-04-2016, 02:49 PM
Getting D in class - by MikeW - 12-05-2016, 12:58 AM
Getting D in class - by LJay - 12-05-2016, 05:40 AM
Getting D in class - by Shawn - 12-05-2016, 06:37 AM

Related Threads…
Thread Author Replies Views Last Post
  Class reunion LONDONER 1 669 10-20-2020, 01:57 AM
Last Post: Bhp91126
  Class reunion LONDONER 0 576 06-22-2014, 08:04 AM
Last Post: LONDONER
  Writing class LONDONER 1 578 07-16-2013, 11:03 PM
Last Post: Dan1980
  I think one of the forums would make a good class... RoydonLeeJ 0 1,058 03-30-2008, 04:14 PM
Last Post: RoydonLeeJ

Forum Jump:


Recently Browsing
1 Guest(s)

© 2002-2024 GaySpeak.com