I am currently giving a course, and one of the things that we do during the course is put an OSS project on the board and analyze it. The project for this course is Whiteboard Chat Project.
Overall, it seems to be a nice project, there are some problems, but most of them are “rich men’s problems”, the kind of problems that are sort of good to have. That said, I intend to write a series of blog posts on the following method:
public ActionResult GetLatestPost(int boardId, string lastPost)
DateTime lastPostDateTime = DateTime.Parse(lastPost);
IList<Post> posts =
.FindAll(new GetPostLastestForBoardById(lastPostDateTime, boardId))
//update the latest known post
string lastKnownPost = posts.Count > 0 ?
posts.Max(x => x.Time).ToString()
: lastPost; //no updates
.ForMember(dest => dest.Time, opt => opt.MapFrom(src => src.Time.ToString()))
.ForMember(dest => dest.Owner, opt => opt.MapFrom(src => src.Owner.Name));
UpdatePostViewModel update = new UpdatePostViewModel();
update.Time = lastKnownPost;
This method is a pretty good example of a multitude of anti patterns and other issues that annoys me.
That said, I would like to clarify that I am merely using this method as an example of some bad issues, I wouldn’t want to give the impression that this is any sort of attack of the project or its authors. I have literally looked at the project for the first time today, and I haven’t even checked who the authors are.
More on that, in the next posts, and in the meantime, I’ll let you figure out how many issues there are there that I am going to talk about…