Patenting can be a frustrating process. It can take many years, and interactions with the patent office can feel like communicating with somebody in a parallel universe. For example, last year you filed your application to protect a new invention. The invention is beyond doubt—you know that nobody does anything like it. But now the patent office has examined it and sent you an "office action" that rejects all the claims! The examiner came up with a couple of prior art things that use the same words as in your claims, or are even using some of the same things, but the older documents discuss something completely different! If the patent office isn't from a different universe, it must certainly have been a Monday morning on Uranus. What's happening? And by the way, why does it take so long?
First, relax. Everybody is doing his or her job.
The patent office (at least the USPTO, but no doubt other patent offices too) has organized its examiners in "art units". The aim is to always direct different patent applications relating to a technology to the same team of examiners, who are well-versed in the subject, and who have become experts just by dealing with it all the time. Some art units have a busy docket, resulting in a longer wait time, and some art units are better matching their workload. Software patent applications can take a long time because there are relatively many interactions before the average application is allowed as a patent. Thus, the art unit's docket is busier. Hardware patent applications can take less time. The fastest I've had an electronic circuit application allowed without speed-up was 124 days. The fastest with TrackOne priority (to get faster examination) was 77 days. I love art unit 2842. They understand my stuff.
Those fast ones are of course applications that were allowed without an office action. For hardware patent applications (for startup companies), I've measured my average at 420 days, and 0.68 office actions per application. In those that get an office action, sometimes not everything is rejected, but it is more usual that all claims are rejected.
The reason for rejection of all claims is in their structure. An independent claim is the broadest claim. A patent application often has 20 claims of which 3 are independent (claim 1 is the first independent claim). An independent claim usually looks like: "Claim 1. A (some invention), comprising:". There are usually quite a few claims that are directly dependent (first-degree dependent) on the independent claims. They might look like: "Claim 2. The (some invention) of claim 1, further comprising:". And then there can be claims that depend on other dependent claims (second-degree dependent claims, etc.).
An independent claim is as broad as possible, if you want to give the patent the greatest commercial value. A first-degree dependent claim adds some limitation, and thereby narrows the scope. A second-degree dependent claim adds another limitation, and further narrows the scope, and so on. If an examiner allows an independent claim, then usually all its dependent claims are also allowed. If the examiner rejects an independent claim, then usually all dependent claims are either rejected (if they don't narrow it down to something allowable) or objected to (if they would be allowable when rewritten in independent form).
You may ask: why are the independent claims so often rejected? Could they be written better, so that they aren't rejected so often?
The thing is, "better" means different things to different companies. For startup companies, "better" means broader—and broader claims have a higher chance of being rejected. For large companies, "better" means cheaper, regardless of a patent's content—and narrower claims are allowed easier, resulting in lower overall cost. So, if I write claims "better" for a startup company, they might be rejected MORE. If I write them "better" for a large company, they get rejected less. Large companies often have a quantity patent strategy—the more patents the better. Small companies don't have the dough to build up large patent portfolios, so for them it is usually much more important that each patent covers an invention as broadly as possible, minimizing the opportunities for competitors to get away with infringement. A startup company cannot bully a competitor by asserting that a competitor infringes 300 other patents. To win a fight, a startup company must show a solid case. That means that the independent claims need to be as valuable as possible, i.e., as broad as possible. My job in that case is to ask the patent office for more than I think they will allow, and write the claim a bit broader than I expect to be allowed. The examiner's job is to respond by saying that I ask too much, and rejecting the claim.
I don't like that game too much—I don't like wasting my customers' money by asking stuff that will not be allowed. So, I end up walking a tightrope. A different tightrope for each application. To prevent any missteps that will make me come tumbling down, I need to know exactly where the rope is. To that end, I need to know exactly what the invention is and what the inventors consider unique about it. So far, it has paid off.
You may still be wondering about those parallel universes. It is normal for an inventor to see the prior art that an examiner has cited, and to be flummoxed by how something so different can come up. It is usually related to a rejection for obviousness. A person who has read everything there is to read about your technology (such a hypothetical person is called a "person of ordinary skill in the art" or POSITA), and maybe adjacent technologies, can find most elements of your claim in one publication, and the missing part(s) in another publication. If the examiner acts as a POSITA and finds two such publications, he or she can reject your invention as "obvious". It's an inherently gray area, so there are lots of rules and there is endless case law to make it more black and white. The examiner may search by key words, and the same words can mean rather different things in different publications. Those differences are not always clear, and the examiner is not given a lot of time for each application. Your patent practitioner must be your expert and should be able to rebut when the examiner has come with an inappropriate rejection. If the rejection is appropriate, your practitioner will amend the rejected claim, provided that your description provides other limitations that can make your independent claim unique and not disclosed or suggested by the prior art.