I guess middleware are stacked :)
real world example use for a stack class in php?
I was watching Uncle Bobs re-factoring video where he creates a Java stack class and refers to the stack kata. Having never heard of this kata, I googled and found the basic useage of a stack here http://www.javacoffeebreak.com/faq/faq0037.html
I also found this repo of the actual stack used in the video https://github.com/tedgaydos/stack-kata
Now I am wondering what are some use cases for a stack class in PHP?
@jeffreyway is this something you would add to the katas series and discuss it's usefulness in a PHP application?
Yep I guess middleware is a stack but specifically a stack as a data structure type which requires specific functions (push, pop, isEmpty) and must follow LIFO(Last In First Out) is difficult for me to wrap my head around. I don't think the middleware stack actually follows this data structure though I can't tell yet because it's much more complex than the stack example above.
I found this book stack example in PHP and more explanation http://www.sitepoint.com/php-data-structures-1/ . I suppose it could be handy if I wanted to be able to pass the stack around for use in different parts of an application to save on database calls, but otherwise I would just work directly with books stored in a database.
Please or to participate in this conversation.