What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

One of those chunks of code


Stroker

Power User
Messages
428
Likes
0
Working on some urinary bitwise junk in VB.
During the course of the day, I have jotted down several pages of notes.
I wrote the code, and made sure that it works properly.
A few minutes later, I have no idea how it works.

Code:
a$ = Mid$(txtStage1.Text, i, 1)
x = Asc(a$)
b$ = Mid$(total2$, bs, 1)
y = x Or (Asc(a$) And (2 ^ j))

If (y And (2 ^ (j - 1))) > 0 Then
b$ = Chr(Asc(b$) Or Chr(Asc(255 And (2 ^ (bp - 1)))))
Mid(total2$, bs, 1) = b$
End If

Some crucial nested logic in there.

A long time ago, when I was writing text adventures, something similiar happened.
For some reason I had to run a loop backwards in order for it work.
I couldn't tell you why, though.
At the time I understood it, but 1/2 hour later it was out of my head.

I just love melting my own brain.
 
Stroker, that is why God created comments to put next to your code. You type

/*and then write down what the heck you are doing and why, then you end your comment with */

Then, not only will you know what your coding reasons and goals were, so would anyone else using your code or trying to...

That has to be the one lesson my instructors beat into everyone's head, was "Comment the heck out of every piece of code you write."

When I'm working on a PS effect, if it is something I may want to remember, I use that stupid yellow Annotation note for the same thing. Saves a lot of "I don't remember exactly how I did this..."

That way, you can save your brain melt-downs for other things... :rofl:
 
Comments in the code aren't my style.
I keep things on regular paper.
I even rip out important pages, or rewrite them, and keep them in a bigger folder.
I've been doing it this way for over 20 years.
It's what works for me.

Like I said, I have 3 pages of scribbles explaining those few lines - can't exactly add charts, diagrams, and flowcharts in comments. Even with those, it's still a brain bender to understand explicitly.

If I can get this program to work, I imagine I can compress text messages down to around 50% or so. With a proper database, even more so. Prolly be a few weeks, though.
 
Holy crud. I finally got all of my code to play nice. I am very amazed at the results that I've been getting.

I'm a genius and that's all there is to it.

More details later.
 

Back
Top