![](https://regmedia.co.uk/2019/08/12/chrome-logo.jpg)
![](https://cdn.sstatic.net/Sites/softwareengineering/Img/apple-touch-icon@2.png?v=1ef7363febba)
![](https://www.developer.com/icom_includes/footers/img/developer_logo.jpg)
![](https://en.wikipedia.org/static/images/footer/wikimedia-button.png)
Yesterday I finished my first web application. It stores business contact cards, just a tiny, monolithic web app project. There are 3 types of entities (User, Corporation, Customer) and it capable to store that entities in a Mysql database. Also there are 2 types of application domains: Customer and User Domain, also it is possible and easy to add new domains.
Entities and Basic Functions:
1- User: The people who use this app divided into two groups; one is admin user, who can not deleted and has CRUD permissions for all domains. And standard users, who created by admin and given different CRUD permissions for different application domains. The users who have create permission for user domain, can create users too.
2- Customer: They can create and edit by users. Removing of a customer has no effect on other entities except their own attributes, such as emails, telephone numbers etc. A customer can have only 1 relation with Corporation.
3- Corporation: The entities which can create and delete by users and must owned by customers. Removing a corporation cause removing all its related customers.
The Tools and Libraries Used
View | Serverside | IDE + Build + Test |
– Jsp 2.4 – Jstl 1.2 Bootstrap | – Java 1.8 – Servlet API 4 – Hibernate 5 – Hibernate Search 5 – Hibernate C3P0 – Log4j 2 – Mysql Community Server 5.7 – Tomcat Server 9 – Nginx Web Server (Reverse Proxy) + Cloudflare SSL – Ubuntu 18.04 Server | – Eclipse IDE for Enterprise – Maven – JUnit 5 – Git |
Source Code Repository: github.com/algunes/TechLog/tree/master/CustomersAndUsers/CustomersAndUsers
Deployed: aliyargunes.com/apps/cards/
Here is some notes which I took from a Google Tech Talks video:
When to use Polymorphism
-> Mainly to do comparisons of primitive objects:
<, >, ==, !=
We’re going to focus on where the business logic should behave differently, that’s the interesting part.
If you really want to be if free in your application, the thing you have to do is you got to make sure you don’t return the Null’s.
What you need is to put an if statement over there to make sure you don’t dispatch a Null.
And that clutter your code. So we want to get away from that.
Don’t return error codes, instead throw an Exception.
Never return a null, instead return a Null Object, e. g. an empty list
Null’s are friends of your test but really your enemy inside of production code.
You really don’t get in a situation when you return Null, because when you return a Null from a method, you can’t dispatch off on a Null. You’ll get a NullPointerException. !!!
If you have a method, the method needs to return some kind of an object that probably doesn’t do anything. Typical example of this would be like the Null Logger.
If I need to Log, I’am always logging except sometimes I get a re-logger that logs the file system and sometimes I get a logger to just eats all my messages and doesn’t do anything.
It started out with some test of sql queries and practising Mysql Workbench to learn it and want to try on some basic relational algebra operators. I have created a database to store customer and order information of an imaginary company. At the tables I have tried to perform some atomicity/singularity processes, I tried to make sure that every single column in a table is single, then at second and third normal form. I can say that it started out with my sql learning event. I have faced some problems like “partial dependencies”, which means when the thing we’re talking about changes the data describing it will also change and if I have a “partial dependency” the data only describes part of the key. And that’s not allowed! In a nutshell I started to ask myself “does this belong here, does it describe all of the columns inside of the primary key?”. If it does it’s appropriate, if it doesn’t it’s not appropriate and I need to put it somewhere else. Also whenever have a transitive dependency all have to do is grab what the closest to the primary key and put it on its own table.
Then, I googled the ACID properties (also found that MySQL is not ACID compliant because it doesn’t support consistency, isolation, or durability.) and test some relationships such as one-to-one, one-to-many, many-to-many. And Entity, referential and domain integrity and some sql joins. Also I wrote some procedures and views to storing and showing data. I upload all of these queries to my github repository.
Continue reading