Looking for coding advice in all languages

Questions about programming languages and debugging
Post Reply
User avatar
floodhound2
∑lectronic counselor
∑lectronic counselor
Posts: 2117
Joined: 03 Sep 2006, 16:00
17
Location: 127.0.0.1
Contact:

Looking for coding advice in all languages

Post by floodhound2 »

I want some of your ideas on coding; generally speaking. I need a good link or a doc that can provide me some code structure, and or concepts. I don't want to learn a specific language if this makes any since.

For example: Today many programmers are sloppy, "I included my self" :? . Back in the day, I remember programming when memory was limited and slop-code was not tolerated. Well, now I need to re-learn some good old fashion clean code practices.

Another example: In digital electronics we can use Boolean algebra to reduce the "Fat" out of the code. This, more often than not will reducing parts and overall cost.

Any advice is appreciated.

8O
₣£ΘΘĐĦΘŮŇĐ

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

Well....i can't say much atm since i have to go to school in a min, but i can say this...

There is a special difference between PHP and C++ (for example) because PHP let's the programmer write in a "ugly" way because it doesn't follow some of the coders unwritten rules, even if you don't intend to write ugly it tends to get that way anyway.

I can't give you any example atm (just woke up), but you can check for definitions about PHP and it might have something about "good/bad"


EDIT: small and quick example...
PHP does not by default enforce the declaration of variables prior to their use, and variables which have not been initialized can have operations (such as concatenation) performed on them; an operation on an uninitialized variable raises an E_NOTICE level error, but this is hidden by default.
Source: Wikipedia, more about it there
"The best place to hide a tree, is in a forest"

G-Brain
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 467
Joined: 08 Nov 2007, 17:00
16
Location: NL

Post by G-Brain »


User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Another link bot? Geez. We'll have to ban this one as well... :roll:
¯\_(ツ)_/¯ It works on my machine...

User avatar
floodhound2
∑lectronic counselor
∑lectronic counselor
Posts: 2117
Joined: 03 Sep 2006, 16:00
17
Location: 127.0.0.1
Contact:

Post by floodhound2 »

Perhaps I need to clear this up a bit, or, am I off a bit? I need to learn more advanced code structures and yet keep things simpler.

Do any of you use a flow chart for example? Possibly the language you write in; a flow chart is over-kill, or simpler the code is not long enough for a flow chart?

I guess I am after some input on how to keep my programs from becoming messy and unorganized. running loops that are efficient and setting flags for more logic conditions, etc.

Sorry if I seem confused, because, truthfully I am!

Just as an example: How would you take 100 numbers and find the 2nd to lowest number of all 100. given the 100 numbers range from 0-32bits. This is easy to do true, but to shorten the code to say 2 or 4 lines makes it a bit more of my problem.

"Please this is an example"- I don't need answers to this example :roll: ...

Please let me know what you think and or a good source for what i am after?

B.T.W G-Brain the link you suggested was not exactly what i was after. Thanks though.
₣£ΘΘĐĦΘŮŇĐ

User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

Post by Big-E »

I think you want to plan out your program before you start coding, right? Well, one could always use UML digrams to plan out code if they are using object orientent languages, or they can use simple pseudo code which basically means planning it out the general structure without really coding; such as:

if apple bigger than pie
then whole apple won't fit in pie
else
apple pie is yummy
exit (return ..etc)

Then there is the UML (Unified Modeling Language) which is used to illustrate objects in very abstract terms. Usually it is drawn something like this.

Code: Select all

_______________
| OBJECT NAME  |  ----- Objects name, association and type.
----------------------
| var One         |   ----- Defines various attributes, variables..etc
| var Two          |
-----------------------
|  actions          |
|  or methods    |   ----- basically represents anything that the object can                           
| or functions     |           'do'
_________________


Sorry for the crappy diagram I was too lazy to open up a program which actually does the UML modeling, taking a screeny, uploading it and then copying a link here. But, you get the general idea.


At University my very first assignment was to do pseudo code of how to get from the classroom to the lab and login to Linux and start emacs. It`s probably kicking around in a box around here, I should dig it out and laugh at it. ^^

User avatar
Nerdz
The Architect
The Architect
Posts: 1127
Joined: 15 Jun 2005, 16:00
18
Location: #db_error in: select usr.location from sucko_member where usr.id=63;
Contact:

Post by Nerdz »

Give a man a fish, you feed him for one day.
Learn a man to fish, you feed him for life.

User avatar
floodhound2
∑lectronic counselor
∑lectronic counselor
Posts: 2117
Joined: 03 Sep 2006, 16:00
17
Location: 127.0.0.1
Contact:

Post by floodhound2 »

Now we are talking! Thanks so much fellas, ill be back with more questions soon. "got to read more about this"
₣£ΘΘĐĦΘŮŇĐ

Post Reply