Tomy surprise, this silly railway analogy really took off, and now there are railway-oriented programming libraries and posts for all sorts of languages, including Ruby, Java, JavaScript, Kotlin,Python and more.
If something goes wrong in executing the command, how does that affect the return value (the list of events created by the command) in practice? Of course you need to handle errors and log them, but do you actually need to return a Result from the function itself? It will make the code more complicated for not much benefit.
Anywhere that there is I/O there will many, many things that can go wrong. It is tempting to try to model all possibilities with a Result, but I strongly advise against this. Instead, only model the bare minimum that you need for your domain, and let all the other errors become exceptions.
Rolling stock on rails generally encounters lower frictional resistance than rubber-tyred road vehicles, allowing rail cars to be coupled into longer trains. Power is usually provided by diesel or electrical locomotives. While railway transport is capital-intensive and less flexible than road transport, it can carry heavy loads of passengers and cargo with greater energy efficiency and safety.[a]
Precursors of railways driven by human or animal power have existed since antiquity, but modern rail transport began with the invention of the steam locomotive in the United Kingdom at the beginning of the 19th century. The first passenger railway, the Stockton and Darlington Railway, opened in 1825. The quick spread of railways throughout Europe and North America, following the 1830 opening of the first intercity connection in England, was a key component of the Industrial Revolution. The adoption of rail transport lowered shipping costs compared to water transport, leading to "national markets" in which prices varied less from city to city.
In the 1880s, railway electrification began with tramways and rapid transit systems. Starting in the 1940s, steam locomotives were replaced by diesel locomotives. The first high-speed railway system was introduced in Japan in 1964, and high-speed rail lines now connect many cities in Europe, East Asia, and the eastern United States. Following some decline due to competition from cars and airplanes, rail transport has had a revival in recent decades due to road congestion and rising fuel prices, as well as governments investing in rail as a means of reducing CO2 emissions.
Smooth, durable road surfaces have been made for wheeled vehicles since prehistoric times. In some cases, they were narrow and in pairs to support only the wheels. That is, they were wagonways or tracks. Some had grooves or flanges or other mechanical means to keep the wheels on track.
For example, evidence indicates that a 6 to 8.5 km long Diolkos paved trackway transported boats across the Isthmus of Corinth in Greece from around 600 BC. The Diolkos was in use for over 650 years, until at least the 1st century AD.[3] Paved trackways were also later built in Roman Egypt.[4]
In 1515, Cardinal Matthus Lang wrote a description of the Reisszug, a funicular railway at the Hohensalzburg Fortress in Austria. The line originally used wooden rails and a hemp haulage rope and was operated by human or animal power, through a treadwheel.[5] The line is still operational, although in updated form and is possibly the oldest operational railway.[6]
Wagonways (or tramways) using wooden rails, hauled by horses, started appearing in the 1550s to facilitate the transport of ore tubs to and from mines and soon became popular in Europe. Such an operation was illustrated in Germany in 1556 by Georgius Agricola in his work De re metallica.[7] This line used "Hund" carts with unflanged wheels running on wooden planks and a vertical pin on the truck fitting into the gap between the planks to keep it going the right way. The miners called the wagons Hunde ("dogs") from the noise they made on the tracks.[8]
There are many references to their use in central Europe in the 16th century.[9] Such a transport system was later used by German miners at Caldbeck, Cumbria, England, perhaps from the 1560s.[10] A wagonway was built at Prescot, near Liverpool, sometime around 1600, possibly as early as 1594. Owned by Philip Layton, the line carried coal from a pit near Prescot Hall to a terminus about one-half mile (800 m) away.[11] A funicular railway was also made at Broseley in Shropshire some time before 1604. This carried coal for James Clifford from his mines down to the River Severn to be loaded onto barges and carried to riverside towns.[12] The Wollaton Wagonway, completed in 1604 by Huntingdon Beaumont, has sometimes erroneously been cited as the earliest British railway. It ran from Strelley to Wollaton near Nottingham.[13]
The Middleton Railway in Leeds, which was built in 1758, later became the world's oldest operational railway (other than funiculars), albeit now in an upgraded form. In 1764, the first railway in the Americas was built in Lewiston, New York.[14]
In the late 1760s, the Coalbrookdale Company began to fix plates of cast iron to the upper surface of the wooden rails. This allowed a variation of gauge to be used. At first only balloon loops could be used for turning, but later, movable points were taken into use that allowed for switching.[15]
A system was introduced in which unflanged wheels ran on L-shaped metal plates, which came to be known as plateways. John Curr, a Sheffield colliery manager, invented this flanged rail in 1787, though the exact date of this is disputed. The plate rail was taken up by Benjamin Outram for wagonways serving his canals, manufacturing them at his Butterley ironworks. In 1803, William Jessop opened the Surrey Iron Railway, a double track plateway, erroneously sometimes cited as world's first public railway, in south London.[16]
William Jessop had earlier used a form of all-iron edge rail and flanged wheels successfully for an extension to the Charnwood Forest Canal at Nanpantan, Loughborough, Leicestershire in 1789. In 1790, Jessop and his partner Outram began to manufacture edge rails. Jessop became a partner in the Butterley Company in 1790. The first public edgeway (thus also first public railway) built was Lake Lock Rail Road in 1796. Although the primary purpose of the line was to carry coal, it also carried passengers.
These two systems of constructing iron railways, the "L" plate-rail and the smooth edge-rail, continued to exist side by side until well into the early 19th century. The flanged wheel and edge-rail eventually proved its superiority and became the standard for railways.
Cast iron used in rails proved unsatisfactory because it was brittle and broke under heavy loads. The wrought iron invented by John Birkinshaw in 1820 replaced cast iron. Wrought iron, usually simply referred to as "iron", was a ductile material that could undergo considerable deformation before breaking, making it more suitable for iron rails. But iron was expensive to produce until Henry Cort patented the puddling process in 1784. In 1783 Cort also patented the rolling process, which was 15 times faster at consolidating and shaping iron than hammering.[17] These processes greatly lowered the cost of producing iron and rails. The next important development in iron production was hot blast developed by James Beaumont Neilson (patented 1828), which considerably reduced the amount of coke (fuel) or charcoal needed to produce pig iron.[18] Wrought iron was a soft material that contained slag or dross. The softness and dross tended to make iron rails distort and delaminate and they lasted less than 10 years. Sometimes they lasted as little as one year under high traffic. All these developments in the production of iron eventually led to the replacement of composite wood/iron rails with superior all-iron rails.The introduction of the Bessemer process, enabling steel to be made inexpensively, led to the era of great expansion of railways that began in the late 1860s. Steel rails lasted several times longer than iron.[19][20][21] Steel rails made heavier locomotives possible, allowing for longer trains and improving the productivity of railroads.[22] The Bessemer process introduced nitrogen into the steel, which caused the steel to become brittle with age. The open hearth furnace began to replace the Bessemer process near the end of the 19th century, improving the quality of steel and further reducing costs. Thus steel completely replaced the use of iron in rails, becoming standard for all railways.
The first passenger horsecar or tram, Swansea and Mumbles Railway was opened between Swansea and Mumbles in Wales in 1807.[23] Horses remained the preferable mode for tram transport even after the arrival of steam engines until the end of the 19th century, because they were cleaner compared to steam-driven trams which caused smoke in city streets.
In 1784 James Watt, a Scottish inventor and mechanical engineer, patented a design for a steam locomotive. Watt had improved the steam engine of Thomas Newcomen, hitherto used to pump water out of mines, and developed a reciprocating engine in 1769 capable of powering a wheel. This was a large stationary engine, powering cotton mills and a variety of machinery; the state of boiler technology necessitated the use of low-pressure steam acting upon a vacuum in the cylinder, which required a separate condenser and an air pump. Nevertheless, as the construction of boilers improved, Watt investigated the use of high-pressure steam acting directly upon a piston, raising the possibility of a smaller engine that might be used to power a vehicle. Following his patent, Watt's employee William Murdoch produced a working model of a self-propelled steam carriage in that year.[24]
The first full-scale working railway steam locomotive was built in the United Kingdom in 1804 by Richard Trevithick, a British engineer born in Cornwall. This used high-pressure steam to drive the engine by one power stroke. The transmission system employed a large flywheel to even out the action of the piston rod. On 21 February 1804, the world's first steam-powered railway journey took place when Trevithick's unnamed steam locomotive hauled a train along the tramway of the Penydarren ironworks, near Merthyr Tydfil in South Wales.[25][26] Trevithick later demonstrated a locomotive operating upon a piece of circular rail track in Bloomsbury, London, the Catch Me Who Can, but never got beyond the experimental stage with railway locomotives, not least because his engines were too heavy for the cast-iron plateway track then in use.[27]
3a8082e126