Place all floats last without changing numbering
So this is my candidate solution which basically consists in manually moving all the floats to the end, and then temporarily hack into the section
counter in order to show the desired numbers.
\documentclass{article}
\usepackage{float}
\newfloat{program}{tbphH}{lop}[section]
\floatname{program}{Program}
\newcounter{savesection}
\newenvironment{fromsection}[1]{%
\setcounter{savesection}{\value{section}}%
\setcounter{section}{#1}%
\renewcommand{\thesection}{\arabic{section}}}
{\setcounter{section}{\value{savesection}}}
\newcommand{\codefrom}[1]{%
\begin{program}[hbt]
\caption{#1}
\label{#1}
\end{program}}
\begin{document}
\section{Introduction}
Please see Program~\ref{dostuff} and \ref{donothing}.
\section{Another thing}
Also see Program~\ref{onlyone}.
\appendix
\section{Appendix}
\begin{fromsection}{1}
\codefrom{dostuff}
\codefrom{donothing}
\end{fromsection}
\begin{fromsection}{2}
\codefrom{onlyone}
\end{fromsection}
\section{Yet another appendix}
\end{document}
As the floats don't really need to “float” anymore, I would furthermore suggest to change their placement simply to “H” rather than “hbt”. Also I have no idea about the terrible things that this could cause if you're trying to use this together with hyperref.