Changes from clean code first part#6
Open
adamtnagy wants to merge 40 commits into
Open
Conversation
…est based on the book Clean Code
In later commits move methods to the SerialDateTest class one by one. This will make it easier to track the progress.
- I am going to use curly brackets for one liners because the codebase is written in this manner and I won't leave this road. - Also there were some line ending issues which I could not resolve
…tant comment for later
- Save comment for later
- Update with curly brackets
…, testLAstDayOfMonth, testAddDays
…fWeek, comment out old testAddMonths
…thod for readability
…etNearestDayOfWeek
…nd testCreateInstanceFromJavaDate - All tests are added to SerialDateTest from BobsSerialDateTest so it is removed
- Test adding two months which increments year by one as well
- I am not sure what the mentioned bug was so I kept the test - It seems redundant though, maybe remove later - This is the only place where the isOn() method is used
…source format and paying attention to some details
…ection, p. 269 in the book: Clean Code
…ing tests, then refactor stringToWeekdayCode so it becomes case insensitive - Find an error in the book ;-)
…ook leaves these tests commented out too. That indicates pretty much the same.
- Uncomment failing tests, then update stringToMonthCode so it becomes case insensitive and correctly returns -1 - Source format: add whitespaces after commas
…n getFollowingDayOfWeek
…ror in getNearestDayOfWeek
… 3 then it is a special case, if it is less than -3 it is another special case
…kInMonthToString and relativeToString
…inished - Minor source formatting
Author
|
Bump. |
|
I think this is great! Why has this not been checked out by anyone? :D |
Author
|
6 years... Time flies, I still remember the Saturday mornings dealing with this, haha. Maybe I wasn't pushy enough. Probably the owner did not see the mail from this pull request or he has better things to do. Or he simply hates that book and the author. ;-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear David,
I was studying the book Clean Code and it has a section where the class SerialDate in Jcommon library is refactored. It is horrible to follow a refactoring process in a book format and I could not find those changes online so I decided to do them myself. I think it is worthwile to have these changes in this repository.
It took quite some time to make the commits as small and obvious as possible, but I am finished with SerialDateTest completely and fixed some issues in the SerialDate class. It should be straightforward from the commit messages where I diverged from the book and followed conventions of the existing code or my taste.
I saw that this Jcommon library is to be retired that is why I selected this as a playground.
I would say that I am one third finished with the whole I have in mind. I plan to finish the refactoring of the SerialDate class following the book as close as possible. (Then Make It Right section, page 270.) Then maybe I have my own ideas both to the class and its tests. I have doubts though that those are relevant in the sense to be able to follow the book's ideas. Hmmm.
Anyway, here is a pull request with the changes so far.
If you find these useful I would be happy to help migrating these to the development branch of JFreeChart - Future State Edition.
I am not sure how the copyrights work in your country and in this particular case, but if you are willing to merge this, then I would suggest to contact the author/publisher for a permit. It would collide with the boyscouting rule not to allow these changes in so it must go smooth. ;-) I also added Robert C. Martin as a contributor to the class and I mention the book in the commit messages too. He is also quite active on Github, probably easy to find. (In case of course if you don't already know each other.)
Finally I would like to mention that I made these changes for educational purposes so it is possible to follow the book. I am sure few people bother to look the source up online, and most of those did turned away when they started to compare it with a book format.
Although It has a nostalgic feeling to keep 4-6 fingers simultaneously between the pages in the book and turn pages like crazy sometimes pressing unwanted keys on the keyboard with the book, but... well it is not efficient in the 21st century anymore. :-)
I hope I can help/inspire other developers in their studies with these changes.
Best regards,
Ádám T. Nagy