See full post at: https://www.infoq.com/articles/infoq-2019-retrospective/ Key Takeaways Last month, Google claimed to have achieved quantum supremacy—the name given to the step of proving quantum computers can deliver something that a classical computer can't. That claim is disputed, and it may yet turn out that we need a better demonstration, but it still feels like a … Continue reading InfoQ’s 2019, and Software Predictions for 2020
Category: OO Design Principles
Avoid NullPointerException in Java
I would like to share with you some tips to deal/prevent NPE in your code: The BIG IMPORTANT rule: do NOT assign / pass / return null value and keep your code as cohesive as possible. Programming tips / techniques: 1. Return an empty collections instead of null. For example: List: Set: Map: 2. Return … Continue reading Avoid NullPointerException in Java
Technical Debt và Legacy System
“The code may not be pretty, but damnit, it works!” Technical debt - tạm dịch là "Khoản nợ kỹ thuật" được dùng nhiều trong Software Engineering. Theo Henrik Kniberg, những khoản nợ kỹ thuật là bất cứ thứ gì trong việc viết mã khiến bạn chậm lại về lâu dài. Ví dụ như là mã … Continue reading Technical Debt và Legacy System
Những nguyên tắc, những định luật của lập trình mà chúng ta nên có sẵn trong đầu
Nguồn : http://qiita.com/hirokidaichi/items/d6c473d8011bd9330e63 Người dịch : Phan Hoàng Minh (https://viblo.asia/minhp/posts/wpVYRP2kG4ng) Nguyên tắc Demeter Còn có tên gọi khác là nguyên tắc “càng biết ít càng tốt”. Demeter là tên gọi của Nữ thần nông nghiệp, cũng là nữ thần phân phát trong thần thoại Hi Lạp. Tên bà được dùng để đánh dấu sự ra … Continue reading Những nguyên tắc, những định luật của lập trình mà chúng ta nên có sẵn trong đầu
Write Private Functions Not Private Methods
From http://pivotallabs.com/write-private-functions-not-private-methods/ Jared Carroll Sunday, June 30, 2013 Khi một class có quá nhiều private method (được gọi là "Lớp tảng băng trôi" - Iceberg class) thì đó là dấu hiệu cho biết class đó có thể đang làm hơn 1 nhiệm vụ (responsibility). Vì vậy việc tách (extract) những private method đó ra class khác giúp lớp … Continue reading Write Private Functions Not Private Methods
From Primitive Obsession to Domain Modelling
From http://blog.ploeh.dk/2015/01/19/from-primitive-obsession-to-domain-modelling/ A string is sometimes not a string. Model it accordingly. Recently, I was reviewing some code that looked like this: There was a few things with this that struck me as a bit odd; most notably the use of IsNullOrWhiteSpace. When I review code, IsNullOrWhiteSpace is one of the many things I look for, … Continue reading From Primitive Obsession to Domain Modelling
Parameter and Return Type Interfaces
From http://brendan.enrick.com/post/Parameter-and-Return-Type-Interfaces Brendan Enrick Thêm 1 ví dụ về Interface Segregation Principle. Trong bài này, tác giả đề cập đến việc áp dụng Interface Segregation Principle cho 2 trường hợp cơ bản nhất là kiểu dữ liệu của tham số (parameter) được truyền vào trong 1 hàm và kiểu dữ liệu của kết quả trả về (return) từ 1 … Continue reading Parameter and Return Type Interfaces
Tản mạn về Dependency Injection
Tản mạn về Dependency Injection Như thường lệ, blog của mình sẽ rất ít các định nghĩa, rất nhiều code, hình ảnh minh họa và những câu nói dí dỏm. OK, hãy bắt đầu với định nghĩa về Dependency Dependency Khi trong class A có sự tồn tại của lớp B, dùng lớp B để … Continue reading Tản mạn về Dependency Injection
Why extends is evil
Improve your code by replacing concrete base classes with interfaces The extends keyword is evil; maybe not at the Charles Manson level, but bad enough that it should be shunned whenever possible. The Gang of Four Design Patterns book discusses at length replacing implementation inheritance (extends) with interface inheritance (implements). Good designers write most of their code in terms … Continue reading Why extends is evil
The Law of Demeter Principle
The Law of Demeter Principle (Tạm dịch là luật cho người thứ 3 - đùa đó) Một đoạn hội thoại "Giờ anh tính giải quyết thế nào về chuyện này?""Ah... anh...""Tôi không biết, chuyện của anh và cô ấy, tốt nhất là anh nên tự giải quyết riêng với cô ấy. Đừng để đến lúc … Continue reading The Law of Demeter Principle