I love both fiction and philosophy. Sadly however they don't mix so well in every case. Now, all of us have a philosophy, even if it's a limited and amateur one. There is nothing wrong with adding your philosophy into a fictional work. In fact, to some degree it is likely inevitable. Most people can't just chuck their views about things out when they write (although the very skilled can present views quite different from theirs).
In some cases though the author seems to view their fiction as a vehicle to present a particular philosophy. This can be very heavy-handed and contrived. I'm going to discuss two examples, bearing in mind I've not read either series entirely.
The first is The Sword of Truth series by Terry Goodkind. I've seen much philosophical science fiction, and this is the only philosophical fantasy series I've come across so far. Anyone even slightly familiar with this is probably aware that Goodkind is an Objectivist, i.e. Ayn Rand's follower.
Many have said that these Objectivist themes only came in later books. In truth though there was some of it from the start. To be sure, they were more understated. Nonetheless, we have Darken Rahl (the main villain, or couldn't you tell from his first name?) being said to live in the "People's Palace" of D'Hara. His "People's Peace Army" has conquered much of the neighboring Midlands. It is not hard to see what all this "People's" stuff references.
More on the nose is a scene when he visits a sympathetic monarch who has a Box of Orden (there are three, and all together would allow him control over the entire world). Rahl is negotiating to get it from her. She and her guests call in a peasant imprisoned for inability to pay very high taxes. He complains about the injustice and they denounce him with very communist-sounding rhetoric. Again, hardly subtle.
Objectivism categorically rejects realism in art, including literature, but it's hard to swallow this. Goodkind's fantasy, like most, takes place in a pseudo Medieval Europe, with the expected monarchy and other features, but adding magic. There is no justification of anyone (let alone monarchs) talking like modern communists (or at least how Goodkind imagines they talk). Not to mention that "People's Palace" absurdity.
Darken Rahl is not called king or emperor but simply "Master", although this changes nothing. He is also a vegetarian, with no clear reason for that. It's not impossible for a vegetarian to still kill human beings (as Rahl did on occasion when people ate meat in his presence) but one suspects that socialism and vegetarianism are simply things that Goodkind dislikes, given Objectivism's condemnation of both.
Later on, a new antagonist leader/country is introduced who are even more obviously communists (though religious ones, which is at least somewhat more realistic in a medieval-type setting). Yet eventually their economy is revealed as like the American one in Atlas Shrugged (undoubtedly an Ayn Rand tribute).
It is thus difficult to imagine how they could field the massive armies we see, or even feed themselves, with a morass of red tape for every decision. Oddly this economy does not seem directly state-run, merely weighed down by bureaucrats having to approve every economic decision and insure it's "fair".
Goodkind seems unable to present his villains being even somewhat nuanced either. All of them are rapists, for example. In regards to their philosophy, it's empty rhetoric that even a child could see through. After all, a king claiming spreading the wealth is good isn't plausible, or calling their palace the "People's".
With the religious communists, it's even worse. It seems much is aimed against Christian beliefs like original sin (it's "spiritual guide" is a monk-like sorcerer). Yet there is only the negative, the idea that human beings are unfathomably detestable to the Creator. Original sin is a concept I too reject, but come on. There is no way Christianity (nor this fictional religion) would have thrived if it had no positive teaching, such as that human beings are sinners, but the divine likeness also.
This isn't simply a matter of whether one agrees with some philosophy presented. I'm neither a vegetarian nor socialist myself. However, it becomes obvious in a case like this that these features are simply dumped into a fantasy world and then presented as things advocated by the villains for the author to rip them apart. Many strawmen are assailed, and the plot suffers.
My second example is David Weber's Honor Harrington series. Although far better written than Goodkind's work, in my opinion, it also can be heavy-handed in its philosophy. The series is military science fiction, with the main enemies at the start being (hmm, this one's familiar) the People's Republic of Haven.
Most succinctly, the PRH could be described as the ultimate parody of a welfare state. The majority of people there (Haven is a multi-system polity, like most shown in the series, which Weber calls a "star nation") do not work at all, but simply live on a Basic Living Stipend, or BLS (probably not coincidental that it's close to "bullshit" also in the acronym). "Dolists" is the slang term for them.
Although nominally a republic, like it's name says, Haven has become in practice a hereditary oligarchy. Heck, the "hereditary" is put right out there before the President's title. Not only him, but also members of Haven's Legislature. This class is called the Legislaturalists.
It's hard to imagine how this could work, although science fiction is a genre with a lot of leeway. Weber doesn't really try to justify it any more than Goodkind however. He simply says that Haven made up for the deficits having most of its citizens living on the dole caused by conquest and plunder of other star nations. Even so, by the series' start they are in dire straits.
What's difficult for me to believe however is that it could last this long. The books indicate that the system in Haven has been existing for centuries. A willing suspension of disbelief can only be stretched so far, even in fantasy and science fiction. It was deeply implausible to me that this would remain so long.
Oddly, despite what the "People's Republic" name would indicate, the economy is later said to be not wholly state-owned, only some parts. When a revolution topples the regime, the new leader understandably realizes they can't go on like this, and uses a war to motivate people into voluntarily going to work again.
It might have been justifiable to have that many people out of work if the economy were largely automated. This is not the case however, as indicated by the need for them working again. What would happen in the case of that much automation could indeed be interesting fodder for a story. Can a society have most people do nothing to earn their keep? Would it? Sadly, though, Weber seems to be just bashing welfare, without any deeper point.
It is not only the shallowness of the philosophy which can be a problem, but where this intrudes into the story with a menace. One book has a prisoner from the good guys, the Manticorans, feign being on the Havenites' side while in their custody. He reflects internally upon his guards' sorry intellects, the product of the Havenite education system which focused more on "validating" them than teaching.
Yes, this is clearly another of Weber's peeves. However my main problem with this was that the characters spends a page or more thinking of this. Never does he say any of it aloud. It's clearly a simple lecture from the author on a subject he feels strongly about, with his villains of course being the strawmen.
It's difficult to have a message in fiction without becoming preachy or hurting the plot it seems. Some would say just keep your messages out of course. I don't think that's possible, since even then you have implicit ones, it's just we don't really recognize them. Nonetheless it does appear to be something that many authors cannot do well (even when they otherwise are good writers).