A lot of times we create our stories and our characters based on ourselves, and things we feel the need to say. A lot of times our characters are ways for us to portray and defend out particular point of view. That's as it should be, I think. One of the greatest things about stories is that they provide a chance for our voices to be heard, via our characters. Being open in this way allows the story to connect with its readers who feel the same way. Like our good pal C. S. Lewis said, "We read to know we're not alone."
What about characters you disagree with?
And I'm not talking about straw men characters--dumb, useless characters that "represent" the opposing point of view just so you can knock it down. I'm talking about really intelligent, engaging characters who fundamentally see the world differently than you do.
(Speaking of gorgeous, brilliant, fantastically written characters who see the world much more pessimistically than I wish to...)
I think there are lots of different ways to do this. Your opposing viewpoint character could eventually come around to your perspective, or not. Or maybe, and this is perhaps my preferred method, your two characters eventually talk things through and realize that many of the areas they thought they disagreed on, they actually have a lot in common. Maybe your opposing viewpoint character isn't even looking for your main character to change their mind necessarily, they're just looking for some sympathy and validation. Maybe that's the journey your main character needs to go on--finding the right way to give the other characters the sympathy and validation they need. Maybe both characters have a lot of growing and changing to do.
So give this a try. Maybe something surprising will come out of it.
Have you ever written a character you disagree with? What characters from books or movies do you disagree with but also love?