-
Preheat the oven to 325°F. Lightly grease a 9" x 13" pan.
-
To toast the nuts: Place the walnuts or pecans in a single layer on a baking sheet and bake in a 350°F oven for 8 to 10 minutes, just until you can start to smell them; set aside to allow the nuts to cool.
-
To make the cake: Mix all of the ingredients except the apples and nuts in a large bowl. As soon as the mixture comes together and becomes pretty uniformly crumbly, stop mixing; you don't want it to turn into a cohesive mass.
-
Add the apples and nuts, and mix until the apples release some of their juice and the stiff mixture becomes a thick, creamy batter, somewhere between cookie dough and brownie batter in consistency. Don't worry if the mixture doesn't immediately loosen up; this will take about 3 minutes at low speed in a stand mixer.
-
Spread the batter in the prepared pan, smoothing it with your wet fingers.
-
Bake the cake for 50 minutes, or until a cake tester or toothpick inserted into the center comes out clean, or with just a few wet crumbs clinging to it. The temperature at the center of the cake will be about 205°F.
-
Remove the cake from the oven and place it on a rack to cool a bit while you make the frosting.
-
To make the frosting: Sift the confectioners' sugar into a bowl or onto a piece of parchment or wax paper; set it aside.
-
Melt the butter in a medium-sized saucepan over medium heat. Stir in the brown sugar and salt and cook, stirring, until the sugar starts to melt and the mixture becomes fairly smooth. While you may still notice a bit of grittiness, you shouldn't see any melted butter pooled atop the sugar. Add the milk, and bring to a boil.
-
Remove the syrup from the heat and pour it into a medium-sized mixing bowl (large enough to accommodate the confectioners' sugar). Let the syrup cool in the bowl for 10 minutes.
-
Pour the confectioners' sugar into the warm syrup in the bowl, then add the vanilla extract or flavor. Whisk until everything is thoroughly combined. You need to work fast here; the frosting stiffens up quickly as it cools.
-
Pour the warm frosting onto the cake, spreading it over the entire surface.
-
Serving and storage information: Cut the cake — either warm or at room temperature — into squares to serve. Store the cake, covered, at room temperature for several days; freeze for longer storage.