Tagged: programming

They say DRY. Some interesting conversation.

Imaginary Friend:

5nf sucks right now

LOL

I have collection(group)[id, name] , permissions[id,name,create,read,update,delete] and then join table

but would be way easier to put the permission in the join table

Sent at 3:07 PM on Wednesday

Amer:

would be easier but more work when you have to extend it

Imaginary Friend:

yeah

Amer:

hold on

is id == id?

and name == name?

Imaginary Friend:

nope

Amer:

are create read update del columns?

Imaginary Friend:

yup

collection.id = jointable[collection_id]

I decided to un 5NF it

because this will probably never change

and I need to be able to enforce a unique constraint in the join table

Amer:

ohh… bad design

come on friend stop being lazy

Imaginary Friend:

the risk of change is VERY low

Amer:

if you are goal is to create 5nf db then every table has to be 5nf otherwise it is worse than 1nf db

Imaginary Friend:

LOL

Amer:

i am just saying

Imaginary Friend:

it’s still technically 5nf

Amer:

no it is not

Imaginary Friend:

because I am just adding meta to the join table

becomes

Amer:

dude not a good idea

Imaginary Friend:

collection[id, name], collectionpermission [collection_id, permission_id, create, read, update, delete], permission[id,name]

Amer:

so you do have a permissions table

Imaginary Friend:

yeah

Amer:

DRY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Imaginary Friend:

it is just that the modifiers [C,R,U,D] don’t really work in a separate table

Amer:

I will break dry principle, and tell you once again Don’t Repeat Yourself

Imaginary Friend:

?

Amer:

never heard of DRY?

Imaginary Friend:

in what context DB?

Amer:

duplicating knowledge

i gues it is more like DIE

Imaginary Friend:

LOL

Amer:

http://en.wikipedia.org/wiki/Don’t_repeat_yourself

Imaginary Friend:

I have specific requirements out of the authentication system tho

I will reuse when I can but there are somethings I want to know how they work

example, coding simple bootloader last night… I could’ve used GRUB

but I wanted to understand how it worked

Amer:

okay i don’t know your requirements…

oh you wanna know why DIE is important… by making bad design decision?

;)

Imaginary Friend:

lol

no, but I think it is important to know how to implement the stuff you are using

Amer:

by making bad product so you can appreciate software engineering wisdom of decades?

Imaginary Friend:

for example, memory management is done for you by java, but because I coded in C I know how malloc and delete work and understand the concepts associated with them…

I never want to be a ‘script kiddie’ programmer

ever

Amer:

so you make bad design decisions, so that then you can learn first hand the pain of bad design decision?

Imaginary Friend:

LOL, I wanna know how it works… in most cases my product ends up looking similar to common wisdom, but you miss the learning experience

we should discuss this on the show

This is what happened with the Y2K thing…

Amer:

i think that’s good way to leanr something.. you will never forget once you have to live through the nightmare of bad design… but then again i learn from other people’s mistake

we will

btw show is looking good

adding sound effects

had isses with Sony Vegas

Imaginary Friend:

I think there are way too many programmers, not to pick on NOBODY, that don’t know how underlying stuff works in real life

LOL

Amer:

http://www.amazon.com/Sony-Vegas-Movie-Studio-Platinum/product-reviews/B001CPHTAQ/ref=cm_cr_dp_synop?ie=UTF8&showViewpoints=0&sortBy=bySubmissionDateDescending#R2SXSK6O2YR1PJ

LOL

so you trying to learn DIE hard way?

Imaginary Friend:

I guess it comes down to passion, I love how awesome computers are… wanna learn as muchh of the stuff I can about them…

I read a tutorial on how this stuff should work… so armed with that knowledge, I am recreating it

Amer:

but you will not DRY?

LOL

Imaginary Friend:

LOL… okay even better example

my bidirectional multidimensional in-place array sort by key in php

I know a lot of people on M dev team whose ass that would have kicked

Amer:

did you use bubble sort for that?

Imaginary Friend:

quicksort

partitioned quicksort

Amer:

why?

Imaginary Friend:

more concerned about memory than runtime

using a pretty good pivot selection algo

so the runtime should be pretty close to optimal

Amer:

but how do you know it really do that?

you learned from the previous programmers’ wisdom?

Imaginary Friend:

I learned the algorithym

but then I had to be able to apply it

lol actually I learned the concept

Amer:

okay this is going no where

Imaginary Friend:

I am just saying DRY/DIe is a good practice

but it pays to understand how the stuff you are using works

I haven’t got much on my plate right now, so coding up this authentication thing is good use of time



if ($num == (int) $num) {
//It’s whole
}
else {
//It’s not
}

So simple… more here