Constant war can become very oppresive. That's why there is a need for a cowboy episode, or for a holodeck episode, some kind of diversion. It also shows that there are other things happening, not just war. It emmulates real life. There is probably also a good reason from production point of view to throw those episodes in. They make the war feel longer.
See I have to disagree with yeah right there. Yes you need a little bit of humor to break up the drama, like C3PO and R2D2 did in Star Wars but the Holodeck episode just down right pauses the story and I have to admit it seems almost an insult to what is going on that while the Dominion and the Alliance was lock in battle, people are dying and the officers of DS9 are farting around with a stupid computer program. It consumes the entire command of the station during a time of war. It is as bad as Mary Todd have parties during the Civil War.
So there has to be a balance of light humor but not side tracking the story too much like Kamen was mentioning. Thought to the idea of the Xindi, i just did not like that story at all. I almost did not watch session 3. Its a prequel it needed to focus on the Romulans, Klingons and birth of the federation.
It got to the Romulans, Klingons, and the birth of the Federation in Season 4.
That was pretty much the focus of Season 4.