Reviewing OSS Project: Whiteboard Chat
Join the DZone community and get the full member experience.
Join For FreeI 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:
[Transaction]
[Authorize]
[HttpPost]
public ActionResult GetLatestPost(int boardId, string lastPost)
{
DateTime lastPostDateTime = DateTime.Parse(lastPost);
IList<Post> posts =
_postRepository
.FindAll(new GetPostLastestForBoardById(lastPostDateTime, boardId))
.OrderBy(x=>x.Id).ToList();
//update the latest known post
string lastKnownPost = posts.Count > 0 ?
posts.Max(x => x.Time).ToString()
: lastPost; //no updates
Mapper.CreateMap<Post, PostViewModel>()
.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;
Mapper.Map(posts, update.Posts);
return Json(update);
}
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…
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments