Thứ Hai, 10 tháng 9, 2018

Understanding Injection

Some definition first, until now I've used the term component when talking about the classes we've been developing. The term is not completely accurate. I should have used instead the term bean for our book repository. A bean is just an object that is managed by the Java EE runtime or container. With a broader view, we can say that in Java EE we have objects that are managed by containers. In fact, in Java EE every object is a bean. Well, I should say, most objects are beans. Most objects are beans except for JPA entities. The difference between a class and a bean is that the container gives a bean extra services such as lifecycle management, interception or injection. In terms of code, a bean is just a concrete Java class with a default constructor. Here the BookRepository class doesn't implement anyspecific interface nor it extends a specific class. It can have any annotation and can define any method. In fact, with very few exception, potentially every Java class with a default constructor is a bean in Java EE. So our BookRepository is considered a bean. But why should we care about knowing the difference between a simple class and a bean? Well because now we can use extra container services, one of them being injection. But what is injection? Applications are made of business logic, interaction with modules, user interface, external APIs and so on. In fact, in an object oriented programming language, like Java, all these can be summarized by objects depend on other objects or let's say beans depend on other beans. But instead of having beans creating their own dependencies, they can delegate these tasks to the container. This is what's called inversion of control. The control of choosing the dependency is inverted because it's given to an external container. The Java EE specification taking care of dependency injection is called CDI, or Context and Dependency Injection. CDI is built on the concept of loose coupling, strong typing. Meaning that beans are loosely coupled, but in a strongly typed way. The container's job is to inject references into these loosely coupled beans. CDI does much more than just injection and I would recommendattending the Pluralsight course dedicated to CDI. CDI decoupling goes further by bringing interceptors, decorators, events and context management to these beans. But that's not the purpose of this course. Let's see how to implement injection.

Chủ Nhật, 2 tháng 9, 2018

Đồ đạc sinh viên

Đầu tiên thì bạn phải làm quen với việc buid set đồ từ đôi giày buid lên. Bạn phải chọn giày đầu tiên rồi mới đến quần áo :D. Mình thấy nhiều bạn mua quần áo thì hiệu này hiệu kia nhưng lại phối với 1 đôi giày dở hơi (giày lười 150k vỉa hè, dép sandals v.v.v.) nên nhìn rất dở hơi và không đâu vào đâu cả.
Nếu bạn muốn ăn mặc trẻ trung năng động thì đầu tiên là tống hết những đôi giày lười rẻ tiền đi và thay vào đó là sneakers. Mình thấy bạn có 1 đôi stansmith rồi - khá ổn và an toàn, phối được với nhiều thể loại, thường thường nên có 1 đôi an toàn ntn (tham khảo các đôi tương tự như vans olskool, converse v.v.v).
Về quần thì mình đoán là bạn đang mặc quần chợ và không thử kĩ nên trông có vẻ lùng nhùng và hơi quá size. Lẽ ra quần thì mình thường thích quần Chinos (kaki) hơn nhưng mình thấy đùi bạn có vẻ to to :sweat::sweat: nên tốt hơn hết là mặc jeans slimfit và nhớ đi chọn cẩn thận để có dáng ôm vừa vặn. Sinh viên thì mua quần tầm 6-800k là oke, tránh mua jeans đen hoàn toàn vì dễ phai màu, mặc vài lần là bạc màu à - suggest là nên mua màu chàm(indigo).:adore::adore:
Áo thì khỏi nói :sweat::sweat: có vẻ là cái áo này bạn mua hàng chợ ~200k, nhìn nó rất dở hơi và nói thật là hơi quê, hơn nữa áo sơ mi trắng trơn chỉ đẹp khi bạn mặc cùng quần tây, sơ vin và là áo phẳng phiu thôi. Mình nghĩ là bạn nên chuyển sang mua T-shirt thì ổn hơn, mua print hoặc trơn đều được nhưng nếu muốn trẻ trung hơn tí thì mua print sẽ tốt hơn, thời tiết mùa thu thì có thể thêm flannel. Còn mua áo sơ mi thì nên mua loại kẻ (caro, sọc v.v.v) và vải tốt hơn tí chứ không phải loại vải trơn lèo nhèo như kia thì nhìn nhăn nheo rất chán đời. và nếu mùa thu mặc sơ mi thì có thể mặc thêm cadigan, nhìn rất hàn quốc và cool :adore::adore:
Về phụ kiện, tốt hơn hết sinh viên các bạn thì đeo balo, hoặc nếu đeo túi chéo thì tránh các loại túi đeo chéo ~150k hàng chợ vì nhìn nó khá là trẻ trâu. Mua hẳn 1 cái túi da ~ 1 củ, bền, đẹp lại thơm nữa. Nói luôn về đồng hồ, thường người ta đeo đồng hồ để khoe và là điểm nhấn của set. Mình không giải thích được tại sao các bạn lại đeo đồng hồ fake < 1-2 củ để nhằm mục đích gì. Nếu cảm thấy trống tay thì bạn có thể tham khảo các loại Bracelets bạc hoặc tràng hạt, vòng tay chứ đừng đeo đồng hồ fake nếu bạn thật sự muốn đầu tư cho ăn mặc :stick::stick:

Hình tham khảo search bừa trên mạng :byebye::byebye::byebye:
source: (Thắc mắc) ra đường thấy ai cũng mặc đồ đẹp, nhìn lại mình thì..