One thing at a time

Rate this:
By asmo (Contact - View My Woyano)
Published Tue 01 May 2007, 186 Views, 0 Comments

If any of you are programmers out there, I would just make an appeal. I'm sure you know what your doing, but I've just spent about 2 weeks going though someone elses code, and for the sake of others, and yourselfs, just think about the following. ( I write in Java at the moment, so its biased to that language)

When making a Class....

    Everything in there should be related to one thing.

    Try make sure that you use interfaces if you can, they save a whole lot of pain.

When making a Method

    Make it private, failing that, make it default. Only use public methods if you have to.


    Pass in only the arguments you need, and don't pass in complex objects only to extract one or two pieces of     data.

    One method, one function, one job, one thing!! I can't stress this enough, don't be doing lots of different             things in the same method.

Class Variables

    You had better have a good reason for using these! If it can be local, make it local.

    And be sure you make them private, if not you had better have a good reason.

State

    Can you make your classes Stateless? i.e. Are they dependant on Class variables for the results from                methods?




   


This Item
Category: Knowledge, Snippets, Computers
Tags: programming,Object Oriented design
Share it
Link to this item:
Bookmark this item: RSS Feed

People who liked this item

    0 Comments

Please Login to Add Your Comment   ..or..  

Replying to comment by