Developers Repeated Mistakes
In this post we are going to discuss about the repeated mistakes of developers during design/implementation/planning etc. This is just a sudden thought process, so this post will grow on my day to day experience and research wise only. Feel free to comment your repeated mistakes to add it to this master list.
In Hibernate/Databases:
While creating/planning a column for description, we forget to define the length of values it can hold or even forget to think such scenarios.
So always think about the value length for each and every column to design a proper optimistic design approaches:
Bad:
Here it can hold only till the default size of 255 length, where as, this field may get the value of length more than 255 as well, in that case this fails and all these type of issues can be completely avoided when we follow the process/standard of keeping always the approximate length with respect to the requirement/understanding/sample data’s available.
[java]
private String couponDescModified;
[/java]
Good:
We estimated based on sample value that it can hold the values with the length around 1000 values, so it is always good to keep the 1500 as base length for this field.
[java]
@Column(name=”coupon_desc_modified”, columnDefinition = “varchar(1500”)
private String couponDescModified;
[/java]