Daily WTF
本來在查 de-coupling 相關的文章,結果看到這篇的範例
PHP:
-
If lblClientName.BackColor = RGB(255, 0, 0) Then 'new client
-
-
'Setup the client account
-
Call SaveNewClientData
-
-
'notify use of success
-
If lblClientNum.ForeColor = RGB(0, 0, 153) Then
-
MsgBox "Client was created but is pending activation."
-
ElseIf lblClientNum.ForeColor = RGB(0, 128, 0) Then
-
MsgBox "Client was created and was successfully activated."
-
ElseIf lblClientNum.ForeColor = RGB(255, 0, 0) _
-
And lblClientNum.Caption = "999999" Then
-
MsgBox "There was an error creating the client. " & _
-
"Please ensure all required fields were entered."
-
End If
-
-
'ED: Snip ...
-
End If
很天才的直接用UI的顏色來判別使用者的權限,將來如果那位設計師用css改了這些顏色,整個business logic就被催毀了,這真正是 MVC anti-pattern的最佳教材啊~
另外,the daily WTF 這個站是工程師們吐苦水的地方,偶爾沒事上去看看笑笑(搞不好還可以學到些警愓)也挺不錯的,我正考慮把上次某金控神奇db的故事貼上去...
by admin


Trackback this post | Subscribe to the comments via RSS Feed