<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/Safari.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
</dict>
This makes the defaults write command required to add an item to the Dock much easier to figure out. So in general, enter the command below in Terminal, substituting the full path to the item in the appropriate place. For applications, use persistent-apps. For files, use persistent-others. Here's the generic structure:
defaults write com.apple.dock persistent-apps -array-add '<dict>
<key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString
</key><string>/Path/to/the/Programme.app</string><key>_CFURLStringType
</key><integer>0</integer></dict></dict></dict>'
Note: The above needs to be entered as one long line with no additional spaces. It was broken here for narrower display width. The string above appears to be parsed correctly, and passes the plutil validity test. At some point, the file ends up being re-written in the usual format. The Dock will have to be restarted to see the effects; you can do that quickly with killall -HUP Dock in the Terminal.
Unfortunately, I don't know how to remove an entry from the Dock's default.plist file from the command line.

