Coding Wisdom #1

  1. If it’s not tested, it doesn’t work.
  2. Source control is your friend – make sure you use it.
  3. Just because you wrote it doesn’t mean you own it — don’t be offended if someone else on your team has to change your code.
  4. Don’t reinvent the wheel, library code is there to help.
  5. The fastest code is code that’s never executed — look for early outs.
  6. Just because you didn’t write it doesn’t mean it’s crap.
  7. Source code is just a hint to the compiler about what you want to do, it won’t necessarily do it (e.g. You might declare a function as inline but the compiler doesn’t have to obey).
  8. Code that’s hard to understand is hard to maintain.
  9. Code that’s hard to maintain is next to useless.
  10. “Whilst I’m editing this file I’ll just…” is a great way to introduce feature creep and bugs.
  11. The neater your code layout, the easier it is to read. The easier it is to read, the easier it is to understand and maintain.
  12. Code is not self documenting. Help others by adding comments to guide them. You may understand it now but what about in 5 years time?
  13. Bad Code can and will come back to haunt you.
  14. There is no such thing as a 5 minute job. It’ll always take at least half a day.
  15. Magic numbers are bad.
  16. Constants don’t take up storage, they’re compile time text substitutions.
  17. Project management will always want you to do twice as much in half the time.
  18. If there is a bug, the user will find it.
  19. A code review is not a criticism.
  20. It’s not the quantity of code that matters, it’s the quality. Any idiot can bang out 40k line of code but that doesn’t make it fit for purpose.
  21. The true cost of poorly written code is in the maintenance.
  22. Eat your own dog food — fixing bugs in your own code helps you code better and improves your understanding.
  23. Code rots over time.
  24. If the user didn’t ask for a feature, don’t add it.
  25. If it’s not tested, it doesn’t work (yes, I know I’ve included that twice but it’s really important)

Quoted from: Drew Eckhardt @ What are some of the most basic things every programmer should know?

Uang Pecahan Rp. 2000

Hari ini (9 Juli 2009), Bank Indonesia resmi mengeluarkan pecahan uang baru senilai Rp. 2000.

Uang pecahan baru tersebut bergambar Pangeran Antasari (Pahlawan Nasional asal Banjarmasin, Kalimantan Selatan) dengan gambar bagian belakang Tarian Adat Dayak. Uang tersebut akan berlaku sebagai alat pembayaran yang sah mulai tanggal 10 Juli 2009. Pemilihan gambar pada uang tersebut mengacu kepada desain uang kertas sebelumnya yang bertemakan Pahlawan Nasional. Hal ini sebagai bentuk apresiasi kepada para pahlawan dan untuk turut serta melestarikan budaya bangsa.

Uang kertas baru pecahan Rp2.000 berwarna dominan abu-abu dengan unsur pengaman berupa tanda air bergambar Pangeran Antasari dengan benang pengaman yang tertanam di kertas uang dan bertuliskan BI2000 berulang-ulang yang akan memendar merah di bawah sinar ultraviolet. Uang kertas pecahan baru ini juga mengakomodasi kebutuhan para tuna netra dengan menyediakan kode tertentu (blind code) di samping kanan bagian muka uang yaitu berupa kotak persegi panjang yang dicetak secara intaglio.

Pecahan 2000 rupiah

Pecahan 2000 rupiah

sumber asal duratia.net

Masalah baru buat para programmer
Programmer pasti tau program untuk menghitung uang kembalian. Salah satu hal yang kadang bikin ribet adalah pecahan uang Rp. 20.000. Nah sekarang, ada pecahan Rp. 2.000. Program untuk menghitung uang kembalian pasti tambah panjang. 😀

Programming is like sex …

Programming is like sex, one mistake and you have to support it for the rest of your life.

Michael Sinz

Though I don’t really understand what it means, but I do agree on the last part: one mistake and you have to support it for the rest of your life. Because, it really happen to me. 😦 (sad)
I have a program which I made 10 years ago, the first year I learn programming. The program was good. But, after years of learning process, I realize how bad my code on that program.
Now, after 10 years, the bug is enormous and many people still depend on my program.

What can I do? I can’t tell them to stop using my program. But, can’t say no to them when they ask me to fix the error. 😦 (sad)

Dibutuhkan: Staff Programmer

JayaMandiri GemaSejati (JG Motor), perusahaan dibidang sales & service untuk YAMAHA. Sehubungan dengan perkembangan perusahaan dibidang teknologi informasi. Saat ini kami membuka lowongan untuk staff programmer dengan ketentuan-ketentuan umum sebagai berikut:

  • Memiliki kemampuan programming PHP & JAVA.
  • Familiar menggunakan program-program berbasis OpenSource & Networking
  • Bisa bekerja dalam tim
  • Usia max 30 tahun

Bagi yang berminat, lamaran bisa dikirimkan ke:

JayaMandiri GemaSejati Motor
Dept. HRGA
Jl. BKR 5
Bandung.

Lamaran diterima selambat-lambatnya pada 23 January 2008

MS Access – MySQL Zero-Length String Problem

I use MS Access to connect to my MySQL database, using MyODBC.

Here is a “simple” problem that give me quite a headache.

  • I create a table on MySQL database with VARCHAR field, NOT NULL
  • I link my table on my MySQL to MS Access.
  • I create a form based on that table.
  • Somehow, MS Access always treat Zero-Length String as NULL. I cannot find any option to make MS Access Zero-Length String value as “Zero-Length String”. So, if I try to empty a control that links to a VARCHAR field, an error pop up with message: “You tried to assign Null value to a variable that is not a Variant data type”.

For a while, I come up with this solution:
Set form KeyPreview property to Yes
Then insert some code in Form_KeyUp:

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If Len(ActiveControl.Text) = 0 Then ActiveControl = ""
End Sub

It works for me. I wonder if someone out there can come up with better solution.
Anyone?