Skip to content

Instantly share code, notes, and snippets.

@altamic
Last active December 24, 2015 09:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save altamic/6780085 to your computer and use it in GitHub Desktop.
Save altamic/6780085 to your computer and use it in GitHub Desktop.
Golden Rule for Software Development

Never deliver code liable to exploit the well-being of colleagues

What you can do

If you agree with the above principle, you are encouraged to adopt measures so that a such conduct can be effectively applied in your environment.

If you are a developer, be ready to point out (perhaps in writing) that you are willing to take full responsibility of your code and for this reason you are expected in some situation (i.e. insufficient technical experience, insufficient aptitude, etc.) to proclaim the impossibility to deliver code for ethical reasons conflicting with the principle. Reciprocally, you should have the right to know the position of each member of your team about the principle.

Any project manager or employer is encouraged to assess the position of each single developer about the principle and commit means so that no one is forced to violate the principle against her/his own will.

History

The principle has been formulated on October 1st, 2013 by me (@altamic) shortly after @epacces, a respected colleague (and friend) of mine, has been subjected to maintain and evolve a software project apparently driven by careless and/or inexperienced colleagues.

A representative excerpt of the offending code is hereby included.

ProgramCellType cellType = [(NSNumber *)[(NSDictionary *)[itemsAttributes objectAtIndex: indexPath.row] valueForKey: NowOnAirCellTypeKey] intValue];
        switch (cellType) {
            case ProgramCellTypeA: {
                NowOnAirCellTypeA *cellTypeA = (NowOnAirCellTypeA *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierA forIndexPath: indexPath];
                cell = cellTypeA;
                break;
            }
            case ProgramCellTypeB: {
                NowOnAirCellTypeB *cellTypeB = (NowOnAirCellTypeB *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierB forIndexPath: indexPath];
                cell = cellTypeB;
                break;
            }
            case ProgramCellTypeC: {
                NowOnAirCellTypeC *cellTypeC = (NowOnAirCellTypeC *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierC forIndexPath: indexPath];
                [cellTypeC showADV];
                cellTypeC.indexPath = indexPath;
                cell = cellTypeC;
                break;
            }
            case ProgramCellTypeD: {
                NowOnAirCellTypeD *cellTypeD = (NowOnAirCellTypeD *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierD forIndexPath: indexPath];
                cell = cellTypeD;
                break;
            }
            case ProgramCellTypeE: {
                NowOnAirCellTypeE *cellTypeE = (NowOnAirCellTypeE *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierE forIndexPath: indexPath];
                cell = cellTypeE;
                break;
            }
            case ProgramCellTypeF: {
                NowOnAirCellTypeF *cellTypeF = (NowOnAirCellTypeF *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierF forIndexPath: indexPath];
                cell = cellTypeF;
                break;
            }
            case ProgramCellTypeA_iPhone: {
                NowOnaAirCellTypeA_iPhone *cellTypeA = (NowOnaAirCellTypeA_iPhone *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierA_iPhone forIndexPath: indexPath];
                cell = cellTypeA;
                break;
            }
            case ProgramCellTypeD_iPhone: {
                NowOnaAirCellTypeD_iPhone *cellTypeD = (NowOnaAirCellTypeD_iPhone *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierD_iPhone forIndexPath: indexPath];
                cell = cellTypeD;
                break;
            }
            case ProgramCellTypeF_iPhone: {
                NowOnaAirCellTypeF_iPhone *cellTypeF = (NowOnaAirCellTypeF_iPhone *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierF_iPhone forIndexPath: indexPath];
                cell = cellTypeF;
                break;
            }
            default: {
                if (iPhone()) {
                    NowOnaAirCellTypeF_iPhone *cellTypeF = (NowOnaAirCellTypeF_iPhone *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierF forIndexPath: indexPath];
                    cell = cellTypeF;
                }
                else {
                    NowOnAirCellTypeF *cellTypeF = (NowOnAirCellTypeF *)[collectionView dequeueReusableCellWithReuseIdentifier: CellTypeIdentifierF forIndexPath: indexPath];
                    cell = cellTypeF;
                }
                break;
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment