Barns are special figures. Each player has one but they have special placement rules and mechanics.
Actually barns trigger the scoring of fields during the game since they cannot share fields with farmers and their pigs.
* When placing a barn, the field is scored as if at the end of the game: 3 points per completed city, 4 points per castle, and you also take into consideration modifiers such the pig, pig-herds, sieges for cities and little buildings.
* When connecting a filed with a barn to another with famers (and pigs): 1 point per completed city, 2 points per castle, also you also take into consideration modifiers such the pig, pig-herds, sieges for cities and little buildings.
After the scoring the affected fields, barns remain but you remove any farmers and pigs involved.
Just in case, you can find the rules here:
https://wikicarpedia.com/index.php/Abbey_and_the_Mayor#Barn...and also a scoring summary (without Little Buildings) here:
https://wikicarpedia.com/index.php/Abbey_and_the_Mayor#Scoring_summary