The old fashioned way to get the name of the current user is to select the record from UserInfo:
select firstOnly name from userInfo
where userInfo.id == curUserId();
Instead of selecting the table UserInfo<, the application has a neat class for such information:
The find method returns a record of type UserInfo and then you can access its fields easily.