What is wrong with this code snippet?

Trigger accTrigger on Account ( After Insert ){
List<Account> accList;
for( Account acc : Trigger.old ){
    acc.Name = acc.Name + acc.Type;
    accList.add(acc);
    update acc;
    }
}

Can you explain what is wrong with this code snippet?
1. According to best practices, the casing and naming should be properly done.
2. If you see, we are working with the after insert event, where Trigger.OLD is not available to be used. It is only available for update and delete triggers.
3. The third problem is the DML statement that is hiding inside the for loop, which could overflow DML Limits.

So, to correct this snippet, we can rewrite the same code, of course with some assumptions:

trigger accTrigger on Account ( after insert ){
List<Account> accList;
for( Account acc : Trigger.NEW ){
    acc.Name = acc.Name + acc.Type;
    accList.add(acc);
    }
update accList;
}

« »