Was watching the season finale of GOT the other day and that got me thinking, was the phalanx formation still used in medieval times? Initially I thought that after the romans people started adopting the more flexible swordsman units. But it wouldn't make sense to abandon a brilliant tactical formation, even if it sacrifices mobility.
This is an Old thread that answers a similar question, I think it will suffice for this one as well. /u/rittermeister has a series of posts that address this question.