Dont name methods with upper case

preview_player
Показать описание
In java never name your methods starting with upper case

#codingshorts #coding #codereview #amigoscode
Рекомендации по теме
Комментарии
Автор

Important to say that it is Java convention. Does not mean it is wrong. In some other languages like C# and Go methods start with uppercase. In fact, in Go some methods must start with uppercase if you want to export them outside of package.

IvanRandomDude
Автор

Doesn't make sense to keep "booking" in the method name as you already call the booking repository. It should be clear that we're dealing with bookings.

deviance
Автор

If it’s happening in, let’s say, BookingService, I think we can omit “booking” in deleteById method name.

gaben-agent
Автор

you must clarify, in java world because in c# world is completely opposite, i'm net developer but i worked with spring two years, and method name was a pain in the neck

haroldpepete
Автор

Thanks for giving out this infos for free

idrisisah
Автор

Actually, why should I write deleteBookingByCode if it is a method of BookingService? It is the same if there is method objectEqualsTo() instead of just equals(). If you don't think so, tell me why, it is really interesting :)

vkapustynskyi
Автор

If the method refers to the object itself and the class name clearly indicates what it is, I don't think it is necessary to include it in the method name. Do you .mapTheList or just .map? Think about it.

brunomonteiro
Автор

I’ve always followed the correct coding standards but I want to know why? Like why does it matter if you are writing code in camelCase or PascalCase

Mohammedis
Автор

don't use return in void method xD

caffeinejavacode
Автор

I see a lot of comments about deleting booking part, well You are wrong. In Java, by convention naming things should be as clear as possible, even ignoring that fact you have to look at the bigger picture, where will that code be used? If I have a method in service that implements that repository I don't wanna look at the name of repository and sometimes people name this instance variable just repository(which is awful for it's own reason). I guarantee you whoever looks at your PR in company setting will request you to change it.

DrHouse
Автор

So, this piece of code will be Don't you think it's a bit redundant?

Yukun