In contrast, a socialist economy allocates resources and labour according to society's needs, which are determined by some mix of economic planning and limited market dynamics.
The only problem being, that while nice in theory, socialist economies never actually did that in practice. Since humanity has never figured out, how to actually do economic planning in some centralized or semi-centralized way without being very inefficient and corrupt. I used to think AI could do that one day, but I guess that was too optimistic...
It's easy to see capitalism is terrible. It's hard to see a better system, that could replace it.