Tab Overload #4

Posted in Links | Leave a comment

I Finish My First Web App Project (Cards)

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

ViewServersideIDE + Build + Test
– Jsp 2.4
– Jstl 1.2
– 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:


Posted in Projects, TechLog | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

About My Abortive Design

Here is an idea for managing the user permissions at my web app. In this design users have different privileges to perform basic crud operations on different app domains (Customer Management Domain, Stock Management Domain etc.). In this way, some specific areas or functions hiding/showing to the user also, and an admin user can grant these permissions.

User Entity:

@Table(name = "Users")
public class Users {
	@Column(name = "id")
	private Long id;
	private String firstname;
	private String lastname;
	@OneToMany(cascade = CascadeType.ALL)
    @JoinTable(name = "name_permission_mapping", 
      joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")},
      inverseJoinColumns = {@JoinColumn(name = "permission_id", referencedColumnName = "id")})
    @MapKey(name = "permission_name")
	private Map<String, Permission> _roles = new HashMap<>();
	public Users() {
	public Users(String firstname, String lastname, Map<String, Permission> roles) {
		this.firstname = firstname;
		this.lastname = lastname;
		this._roles = roles;

	// getters + setters + toString

Continue reading
Posted in Projects, Software Architecture, TechLog | Tagged , , , , , , , | Leave a comment

“Without An If” Notes

Here is some notes which I took from a Google Tech Talks video:

When to use Polymorphism

  • if an object should behave differently based on its state
  • If you have to check the same condition in multiple places Use Conditionals

-> 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.

Continue reading
Posted in General Concepts | Tagged , , | Leave a comment

“I Can’t read my own note. I make a note and I can’t read it. Its an important…”

Posted in Days | Tagged , | Leave a comment

How I started to build my first web application: Customer Cards Database

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
Posted in Projects, TechLog, Works | Tagged , , , , | Leave a comment