I am new 2 FreeBasic.
Maybe
If 50% of people actually cared about reading my code,I might
change it.The way I see it is that really programmers can read any
kind of code.I'm not a real programmer though.Been playing around
with stuff.I rarely do anything besides loops and basic math functions.
change it.The way I see it is that really programmers can read any
kind of code.I'm not a real programmer though.Been playing around
with stuff.I rarely do anything besides loops and basic math functions.
what you need to do is think for a second. you're now coming to a forum filled with programmers devoted to fb.
thinking "good programmers can read any code" is like saying "good maids can clean anything, so i'm gonna $%#@ on my kitchen floor"
yeah ... we are real programmers. and we are telling you, that kind of stuff is the absolute fundamentals of good programming.I'm not a real programmer though.Been playing around
with stuff.I rarely do anything besides loops and basic math functions.
thinking "good programmers can read any code" is like saying "good maids can clean anything, so i'm gonna $%#@ on my kitchen floor"
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
Re: Maybe
Oh, we care, otherwise we wouldn't be replying.2 wrote:If 50% of people actually cared about reading my code,I might
change it.The way I see it is that really programmers can read any
kind of code.I'm not a real programmer though.Been playing around
with stuff.I rarely do anything besides loops and basic math functions.
And we can almost read any kind of code, but if I saw a dev team member give me this sort of code as source for a bigger project, I'd skin them. Alive.
You said yourself that you compress your source files with ZIP? Well, ZIP, like virtually all other compression formats, is designed to reduce redundancy in your files. In plain English, it removes repeated stuff. Putting in spaces and/or tabs in your source, once compressed, won't even make a scratch in the size of your archive, especially if it's ZIP.
Besides, programming tersely (i.e. small) went out of fashion in the 1980s. Your computer isn't sitting on your lap with a 15 x 5 LCD staring back up at you from the keyboard anymore. Your monitor isn't emitting the phosphorus green glow signifying the yesteryears of the computing age.
The technology has grown. Now's as good a time as any to grow with it.
Well,OK,maybe.
When that guy said
>thinking "good programmers can read any code" is like saying "good >maids can clean anything, so i'm gonna $%#@ on my kitchen floor"
I wouldn't go quite that far.I might include comments sometimes,but
seriously,is it really THAT hard 2 read? You can see where the end
of a FOR loop is cause you see NEXT.You know when an IF statement
ends cause you see END IF.The programs I post recently are actually
the biggest I do.These programs wouldn't be neccessary if FreeBasic
automatically had arbitrary precision.I ONLY use FreeBasic because
it can compile.Compiling is something that a lot of the Basic languages
don't have.Remember that site where you can download the powers
of 2? ALL those files were made with FreeBasic.
Except the negative exponents.
>thinking "good programmers can read any code" is like saying "good >maids can clean anything, so i'm gonna $%#@ on my kitchen floor"
I wouldn't go quite that far.I might include comments sometimes,but
seriously,is it really THAT hard 2 read? You can see where the end
of a FOR loop is cause you see NEXT.You know when an IF statement
ends cause you see END IF.The programs I post recently are actually
the biggest I do.These programs wouldn't be neccessary if FreeBasic
automatically had arbitrary precision.I ONLY use FreeBasic because
it can compile.Compiling is something that a lot of the Basic languages
don't have.Remember that site where you can download the powers
of 2? ALL those files were made with FreeBasic.
Except the negative exponents.
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
It's hard to find a next when it's clutterred with a bunch of other code on the same column...But I kind of get what you're saying.
If you plan to actually get serious in coding, start good habbits now. Whether it's a small program or a large one, do it.
If you don't plan to ever get serious with coding, at least do the proper indentations before you show it to others.
If you plan to actually get serious in coding, start good habbits now. Whether it's a small program or a large one, do it.
If you don't plan to ever get serious with coding, at least do the proper indentations before you show it to others.
Well,that's a bit hard.
I don't exactly know what is easier 2 read.When code has indents in it,
it actually makes it harder 4 me 2 read! I am VERY weird.I don't
like the things that most people do.Did you know I think black and white
are the most beautiful colors? I also am not attracted 2 girls like most
guys.If I think something makes something easier 2 read,I'll do it.
This is pretty easy 2 read.
This is what I call hard!
it actually makes it harder 4 me 2 read! I am VERY weird.I don't
like the things that most people do.Did you know I think black and white
are the most beautiful colors? I also am not attracted 2 girls like most
guys.If I think something makes something easier 2 read,I'll do it.
This is pretty easy 2 read.
Code: Select all
print "This program will print prime numbers up 2 the number you want."
print "Enter a number."
DIM AS ULONGINT a,b,c
input c
cls
print "2"
for a=3 to c step 2
p=0
for b=3 to sqr(a)
if a mod b=0 then
p=1
exit for
end if
next
if p=0 then
print a
end if
next
sleep
Code: Select all
print "This program will print prime numbers up 2 the number you want.":print "Enter a number.":DIM AS ULONGINT a,b,c:input c:cls
print "2":for a=3 to c step 2:p=0:for b=3 to sqr(a):if a mod b=0 then:p=1:exit for:end if:next
if p=0 then:print a:end if:next:sleep
Re: Well,that's a bit hard.
Not for me it isn't - well 'reading' may be easy, but understanding what is written or meant isn't.2 wrote:I am VERY weird ... This is pretty easy 2 read.
You are free to be as weird as you want, you can choose to reject all and any conventions others may have or require, but, if you ever come to seek help or advice from others on your programs you are reducing the chance of anyone giving help if you reject the conventions they are expecting.
Re: Well,that's a bit hard.
Well, if it makes you feel any better, I call that hard to read as well. :)2 wrote:This is what I call hard!
Code: Select all
print "This program will print prime numbers up 2 the number you want.":print "Enter a number.":DIM AS ULONGINT a,b,c:input c:cls print "2":for a=3 to c step 2:p=0:for b=3 to sqr(a):if a mod b=0 then:p=1:exit for:end if:next if p=0 then:print a:end if:next:sleep
i timed it, it took me 59 seconds to make that code clean. would taken no time if i just coded it originally in that form.
Code: Select all
Dim As uLongInt a,b,c
Print "This program will print prime numbers up 2 the number you want."
Print "Enter a number."
Input c
Cls
Print "2"
For a = 3 To c Step 2
p = 0
For b = 3 To Sqr( a )
If a Mod b = 0 Then
p=1
Exit For
End If
Next
If p = 0 Then
Print a
End If
Next
Sleep
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
Well,I'm not against learning.
The real reason I can understand my code is because I wrote it!
If somebody else makes their own program,I might need time
2 figure it out.If only I could see what my code looks like from
somebody else's view.Have you ever wondered if people see the
same colors as you do?
If somebody else makes their own program,I might need time
2 figure it out.If only I could see what my code looks like from
somebody else's view.Have you ever wondered if people see the
same colors as you do?
I have wondered that... It's an interesting question.
Anyhow, you should check into some other programming languages. A good programmer is always flexible, remember! I would recommend checking out something other than a BASIC dialect, just to learn something new.
Here's a bit of C++ for you to chew on:
That's a bit of code I'm actually using in my current project... It's part of my config file parser.
edit: By the way, if you use Dev-C++, how do you not know how to use SUBs and FUNCTIONS? A SUB is just like a void function in C, and a FUNCTION is the same as a normal function in C.
Anyhow, you should check into some other programming languages. A good programmer is always flexible, remember! I would recommend checking out something other than a BASIC dialect, just to learn something new.
Here's a bit of C++ for you to chew on:
Code: Select all
int Parser::LineStartPhrase(std::string phrase)
{
char token;
std::string final;
do
{
token = currentfile.get();
if (token != ':')
final+=token;
else
break;
} while (token != ':');
if (phrase == final)
return 1;
return 0;
}
edit: By the way, if you use Dev-C++, how do you not know how to use SUBs and FUNCTIONS? A SUB is just like a void function in C, and a FUNCTION is the same as a normal function in C.