Posts

Showing posts from January, 2020

Django Models Foreign Key Integrity

Image
Django database integrity: ForeignKey on_delete options Django comes with a very robust Object Relational Mapper(ORM) for managing Relational Management Database Management Systems. I will be writing about Django’s  ForeignKey  on_delete options for determining how deletion of referenced data is handled by the database so as to maintain data integrity. The options for the  on_delete  include: 1 CASCADE 2 PROTECT 3 SET_NULL 4 SET_DEFAULT 5 SET() 6 DO_NOTHING We are going to create two models to demonstrate the use cases for the above options. A  Post  and a  Comment  model. I have defined the serializers and views for the post and comment respectively. For brevity, I have omitted them. I am using the browerable API to make the requests to the server. I have a DB Browser for SQLite and I will show the contents of the database as we progress. CASCADE Cascade emulates the SQL constraint of  ON DELETE CASCADE...

Clean code, dirty code, human code

Image
Last week, Dan Abramov posted a very personal and humbling blog post entitled  Goodbye, Clean Code . I saw a tweet about this in my timeline and, being a long-term proponent of “clean” code, TDD and things of that ilk, I was naturally concerned. Here’s what I replied with. Daniel Irvine @d_ir @dan_abramov  You’re conflating two separate things. One is the desire to write clear, well-structured code. Another is your belief that your code is more valuable than that of your colleagues. I fear you’re missing the more important lesson. Human code > clean code > clever code > dirty code 15:00 PM - 12 Jan 2020    1   25 I dislike Twitter because it’s so hard to find any nuance to arguments. So in this post I’ll explain what I mean by  human code . It’s easier to blame code than it is ourselves I think it’s wonderful that Dan is blogging about deeply personal experiences in his career. Many programmers who become team lead...

Types of Worship

Come, let us bow down in worship, let us kneel before the Lord our Maker.  Psalm 95:6 NIV Worship is a dominant theme from Genesis to Revelation because the God who created all things and redeemed us in Christ is worthy to receive all honor, praise, service, and respect (e.g.,  Gen 12:7-8 ;  14:19-20 ;  Exod 15:1-18, 21 ;  Rev 4:11 ;  5:9-10, 12 ). Three groups of words throughout the Bible convey aspects of what we commonly call “worship.” NT writers use these and related terms in a transformed way to show how Jesus has fulfilled for us the pattern of worship given to Israel. Worship as Homage or Grateful Submission to God: The most common word for “worship” literally means “bend over” or “bow down.” It describes a gesture of respect or submission to human beings, to God, or to idols ( Gen 18:2 ,  Exod 18:7 ,  20:4-6 ). Combined with other gesture-words this term came to be used for the  attitude  of homage that the gesture rep...