How is the matching principle implemented with double entry accounting? I understand that the accounting matching principle requires incurring the expense in the same period as the revenue.  But I'm confused how one would go about doing this in double entry accounting.

For example, imagine in 2016 I pay a subcontractor \$50,000; and, in 2017, I finish the work and issue an invoice for \$80,000.  Now, since I didn't invoice for the work in 2016, I can't show the 50k as an expense, but rather an asset; only in 2017 do I move it from an asset to an expense.


Does that mean that every expense in the chart of accounts needs to have a matching asset category? For example, if I have an expense "Subcontractor", I need to have an asset "Accrued Subcontractor"? None of the chart of accounts I've seen have such a repetition, and it seems unwieldy and error prone.


And, if I don't have the same level of detail in my Assets as the Expenses, then, when it becomes time to move them from Assets to Expenses, where will I get that information?


If I invoice based on cost-plus-fee, won't I have a chicken and egg problem? When I look at the cost of a project, there won't be expenses until I invoice? So how will the costs show up?


A great example would be to give the general ledger entries for my exact scenario.
It appears that you mix up the timing of invoicing with the timing of accrual of an expense or a revenue. There exist special Balance Sheet accounts that do not affect the P&amp;L (with names like "Next-period Expenses" in the Assets side or "Next-period Revenues" in the Libailites/Equity side, depending on the country of course) which you use in order to account for such transactions, where invoicing does not track step-by-step the creation of costs and revenues. Small companies use these usually only when they "trespass" the fiscal-year time-boundary. Big companies may use them month-per-month.
In your specific example, assume that even by accounting standards, you are not entitled to recognize revenue in the current year, because, say, there are clauses in your contract that affect the economic substance of the deal. Still, your subcontractor invoices you now. You will credit the subcontractor account, and you will debit, not expenses, but "Next-period Expenses", and it will be a component of your Assets in the coming Balance Sheet. 

Next year, when you will invoice your customer, you will credit this account and you will debit the relevant expense account, thus recognizing in the P&amp;L the expense in the same period that you have recognized the revenue. 

Assume that the subcontractor offers software development services and that your Accounting system has the Expense account "Third Party software Development services". Then in the ledger will see this year

\begin{array} { r  r  r |}
  \hline 
\hline                       
  \text {Account Description} &amp; \text {Debit} &amp;  \text{Credit}\\
  \hline                      
\text{Next-period Expenses} &amp; 50 &amp;  \\
\text{Accounts Payble} &amp;  &amp;  50\\
\hline
\end{array}

If you also pay the subcontractor then you get

\begin{array} { r  r  r |}
  \hline 
\hline                       
  \text {Account Description} &amp; \text {Debit} &amp;  \text{Credit}\\
  \hline                      
\text{Accounts Payble} &amp; 50 &amp;  \\
\text{Cash Deposits} &amp;  &amp;  50\\
\hline
\end{array}

Next year, when you invoice the final customer we have, to recognize the expense

\begin{array} { r  r  r |}
  \hline 
\hline                       
  \text {Account Description} &amp; \text {Debit} &amp;  \text{Credit}\\
  \hline                      
\text{Third Party software Development services} &amp; 50 &amp;  \\
\text{Next-period Expenses} &amp;  &amp;  50\\
\hline
\end{array}

which makes the balance of "Next-period Expenses" zero,

and the revenue of course

\begin{array} { r  r  r |}
  \hline 
\hline                       
  \text {Account Description} &amp; \text {Debit} &amp;  \text{Credit}\\
  \hline                      
\text{Accounts Receivable} &amp; 80 &amp;  \\
\text{Services sold} &amp;  &amp;  80\\
\hline
\end{array}

There are more complicated situations of course, for example, when you are entitled to recognize part of the revenue now, even though you have not invoice your customer, but I  leave them as a practice opportunity for you.