Using Salesforce files over attachments has many advantages:-
Migrating to Files instead of Attachments, or to Enhanced Notes instead of Notes, is a good idea because Salesforce Files provide you much more capabilities around sharing the file (or enhanced note) with other users, groups, or records. It also supports file previews and revisions. It is the future of managing content in Salesforce.
The sharing aspect is really important here. With classic Notes &
Attachments, you must upload them to a single record and anyone who
has access to that record can see the attachment.
By using Salesforce Files, you can share the file with users, groups, or records. If you needed to give someone access to the file but the user didn’t have access to the record the file was originally shared to, fine, just extend sharing of the file to the user and not compromise your org’s record sharing rules, and definitely not create more duplicates of the attachment.
The objects come to the Picture are:-
You cannot insert ContentDocument directly. Whenever inserting ContentVersion record triggers to create ContentDocument and Contentdocumentlink in the background. You can upload multiple version of a ContentDocument using contentVersion.
ContentDocumentlink represent Represents the link between a Salesforce CRM Content document or Salesforce file and where it's shared, ContentVersion represent a specific version of a document in Salesforce CRM Content or Salesforce Files. ContentDocument represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files.