Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^5: Hide Data based on account

by snopal (Pilgrim)
on Oct 02, 2007 at 15:35 UTC ( #642143=note: print w/replies, xml ) Need Help??

in reply to Re^4: Hide Data based on account
in thread Hide Data based on account

It is clear you need to define some form of permission map and decide how to implement it. The problem is; what strategy to use.

Ask ten developers and get ten answers, most of which won't apply to your specific situation. It really boils down to what you are willing and capable of doing with the resources you have. If you find that the components you have don't supply enough information to make a decision in every case, then you are going to have to develop that yourself. If you do have all the information, but don't have a strategy to implement the decisions, START SIMPLE.

It is not a sin to have your entire logic tied to an IF logic tree, especially initially. Don't over-complicate your solution just because you are looking for elegance. If elegance comes to you, and it provides the solution you are looking for, well... excellent!

A strategy that is useful is compartmentalizing. If you have this THING that needs to only show when a set of values align. Go for it. Make it a TRUE/FALSE subroutine, and then move on. Solve each situation similarly. You are bound to find some overlap. When it is natural, combine or re-use. As you go along, some patterns may emerge that speaks to you of a clear and elegant solution to large portions of your already written logic. Good for you.

The sin will be worrying about optimizations and elegance too early. Don't do that. It will drive you insane. Start simply, make sure it completely works for the situation it was designed for and move on. If you write readable code, comment where necessary, and don't sweat the beauty of it all, you may find you have created a completely suitable solution after all.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://642143]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-10-28 21:00 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (264 votes). Check out past polls.