Doubt in the definition of thermodynamic work I am reading the Moran's Fundamentals of Engineering Thermodynamics. He gives the thermodynamic definition of work as:

A particular interaction is categorized as a work interaction if it satisfies the following
criterion, which can be considered the thermodynamic definition of work: Work is done by
a system on its surroundings if the sole effect on everything external to the system could have
been the raising of a weight. Notice that the raising of a weight is, in effect, a force acting
through a distance, so the concept of work in thermodynamics is a natural extension of the
concept of work in mechanics. However, the test of whether a work interaction has taken place
is not that the elevation of a weight has actually taken place, or that a force has actually acted
through a distance, but that the sole effect could have been an increase in the elevation of a
weight.

I am not able to understand what actually he meant by this thermodynamical definition of work. What actually is raising the weight means in this definition?
He told the thermodynamical work to be the extension of mechanical work.
Please help me in understanding it.
 A: The essence of thermodynamic work is that the energy of all the particles in the system are elevated (or depressed) identically in concert. This is the case whether we're raising a weight, stretching a surface to have more area, pressurizing a gas, polarizing something with an electric field, magnetizing something, elastically deforming it, and so on.
In fact, if the system is very cold, then the reference state and a history of the work is nearly enough to know everything there is to know about each particle (in a relative sense to a hot system's randomness and uncertainty).
The most accessible physical analogy here to represent this unified change in energy is perhaps lifting a weight, so Moran uses this as an example. The goal is to distinguish doing work from the other two ways of adding energy to a system: adding more material and heating it. In the case of the latter—heating—we change the distribution of energy states, meaning the dispersion of positions and momenta of the individual particles. In contrast, work does not alter this dispersion.
(Broadly, the dichotomy between work and heat could be compared to the dichotomy of the average and the standard deviation of a simple distribution such as the Gaussian distribution. Changes to the distribution can be decoupled into changing its central location or average and changing its width or standard deviation. If this analogy isn't helpful or familiar to you, though, please ignore it to avoid confusion.)
McQuarrie in Statistical Mechanics puts it as follows in a somewhat more sophisticated treatment:

A molecular interpretation of thermodynamic work, then, is a change in the quantum mechanical energy states of the system, keeping the population over them fixed... [In contrast,] when a small quantity of heat is absorbed from the surroundings, the energy states of the system do not change ($N$ and $V$ are fixed), but the population of these states does.

Again, the aim is to define work in contrast to heat: an increase in all particles' energies in unison, envisioned in practical terms as lifting a weight.
As another physical example, consider two flywheels cooled to approximately 0 K with all their weight distributed at radius r. I spin them up in opposite directions and then press them together, bringing them to a halt (at some final temperature T) through friction. By spinning them up, I did work; note that the momenta of the constitutive molecules remained perfectly clustered, with essentially no dispersion. In other words, if I knew a molecule’s position, then I knew its momentum almost exactly: rotating either clockwise or counterclockwise.
After braking, the total energy and linear and angular momentum of the complete system are unchanged, but now the wheels are relatively hot, the molecules are vibrating energetically, and I don’t have a clue of any particular molecule’s momentum. The distribution of particle energies has been substantially broadened due to the conversion of kinetic energy to thermal energy. The same result would be obtained by heating the initially motionless wheels to temperature T.
