Tutorials?

General discussion for topics related to the FreeBASIC project or its community.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Tutorials?

Post by Tourist Trap »

Don't be a cargo cultist -- understand the meaning and purpose of every line of code before you try to change it.
:)
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Tutorials?

Post by lizard »

If you read a classical tutorial, there are example lines, and mostly example programs included. A experienced programmer already knows the typical elements of a program, it is just to find the right syntax in this piece of software he is working on. So he can save some time with modifying existing examples instead typing them in himself. Thats programmers style.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Tutorials?

Post by MrSwiss »

lizard wrote:A experienced programmer already knows the typical elements of a program, it is just to find the right syntax in this piece of software he is working on.
So he can save some time with modifying existing examples instead typing them in himself.
Thats programmers style.
No, don't agree, programmes style would be:
consulting the reference manual, of the language s/he's currently using ...
(tutorials are mainly for those, not understanding manuals "technical language" used)
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Tutorials?

Post by deltarho[1859] »

If we have a problem A and a solution B which requires five steps, say, then we may not be able to solve A by consulting a manual only. Each step would be described in detail in the manual but the steps may not be obvious. Being able to understand, for example, the Window APIs is one thing but knowing which API to use for each step is another if we do not know what the steps are.

We learn by example and by direct experience. Much of my learning at PowerBASIC was got by example by searching through the forum archives and I do the same at FreeBASIC. There are examples at MSDN but not enough, in my opinion. It may not be clear what some forum code is doing, a lot of code is poorly commented, and that is where the manual comes in so as to put some 'flesh on the bones', so to speak. The experience comes in when our code does not work and we then need to fathom out why. If we publish a solution on a forum then it provides an example for others to find.

If I cannot find any examples anywhere but I still have to work out the steps then programming can get tough. As a last resort, I may come here for help. A well-written tutorial, on the other hand, can be a godsend.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Tutorials?

Post by BasicCoder2 »

Perhaps this will illustrate where I am coming from.
It is not about the language it is about the algorithms.
The code only makes sense if you understand the algorithm and math being used.

I have been using this tutorial utube series to try and learn the math and algorithms for backpropagation in a neural net.
It is long winded but so far seems to be explaining what is needed to be known at each step without assuming the student knows calculus or the relevant Python code. Instead it explains what is needed to be known at each step.
I have just finished unit 7
https://www.youtube.com/watch?v=EnGmg-kvpYs

The example code is in Python so I have to translate to FreeBASIC.
In this example from unit 7 the code iterates to 4

Code: Select all

' https://www.youtube.com/watch?v=EnGmg-kvpYs
' Python code

' def slope(b):
'    return 2 * (b-4)
'
' b = -20
'
' for i in range(10)
'    b = b - .1 * slope(b)
'    print(b)
'

function slope(b as single) as single
    return 2 * (b-4)
end function

dim as single b
b = -20
for i as integer = 0 to 80
    b = b - 0.1 * slope(b)  'b - 1/10 of slope
    print b
next i
sleep
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Tutorials?

Post by lizard »

BasicCoder2 wrote:The code only makes sense if you understand the algorithm and math being used.
Disagree. Do you think i could calculate any planetary orbit myself with paper and pencil? No way. It is extremely difficult because the planetary orbits are not only ellipses, they are influencing each other, and all together is constantly moving.

For this we have Swisseph. We use these functions without knowing in detail what happens inside them. Same goes for whole OSes. Who knows how windows or linux internally works? Nobody knows everything. We can only try to make life a little easier.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Tutorials?

Post by BasicCoder2 »

I can't connect your response with anything I wrote?
Using a piece of code without knowing how it works isn't the same as reading a piece of code with the goal to understanding how it works.
As far as I can make out most professional code amounts to stringing together other people's code without any understanding of how it works only how to use it in their own code. I have used D.J.Peters multiput without understanding how it works only how to use it. Given proper instructions I could probably also use his NeuralNetworkClass but such instructions did not come with the code.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Tutorials?

Post by lizard »

It all depends on the reason why you are programming. If your intention is to bring a light in the darkness for the lost souls, then it is devotional service for god. If not it is nothing but a waste of time.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Tutorials?

Post by badidea »

The problem with the NeuralNetworkClass is that it is very well written. A translation from the code here. Comments like "// put I into I" don't help either.

The main code is a bit abstract:
* net.init()
* net.learn(CEILING)
* net.exploit()
Huh? what are we learning? What is this ceiling?
So one needs to look up these functions:
* net.init() - Ok, initialize network with random weights. I understand.
* net.learn(CEILING) - Loop CEILING times: newIO(), forwardpass(), backpropagate(). What? Dig deeper...
* net.exploit() - Loop ic (10) times: newIO(), forwardpass(), reportIO(). What is ic? why 10 times, what is happening here?
Investigate what newIO(), forwardpass(), etc. do...

On the general topic of tutorials. Probably best to start with some tutorials yourself and hope that others get motivated as well?
Writing good tutorials (like fxm is doing) is a lot of work.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Tutorials?

Post by BasicCoder2 »

badidea wrote:On the general topic of tutorials. Probably best to start with some tutorials yourself and hope that others get motivated as well?
Which is why I revealed the tutorial I was using to try and understand how to write a working ANN :)

Should I ever get an ANN up and working and solving some interesting classification problem I will post the FreeBASIC code and explain it at a level that someone like myself would be able to understand.
Writing good tutorials (like fxm is doing) is a lot of work.
Where are the fxm tutorials?

Writing a tutorial is a separate talent to understanding the subject matter of the tutorial.
Some people are really good at it and others are hopeless at it as you may know if you look at any of the tutorials on the internet.

Many programmers are prepared to share their code but have no interest in explaining it to those who are not up to speed on the subject matter or coding techniques being used.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Tutorials?

Post by badidea »

BasicCoder2 wrote:Where are the fxm tutorials?
I mean these Index page of tutorial / teaching / pedagogical topics (draft articles for documentation). To be fair, mostly be fxm, at least one by MrSwiss.
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Tutorials?

Post by deltarho[1859] »

BasicCoder2 wrote:Many programmers are prepared to share their code but have no interest in explaining it to those who are not up to speed on the subject matter or coding techniques being used.
That may be true to some extent but I believe that it is more likely that many programmers are not able to explain things very well and keep clear of trying to do so.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Tutorials?

Post by badidea »

I once tried to write a tutorial while making a game. I didn't get very far with the game and the tutorial stalled even earlier:
https://nr100.home.xs4all.nl/badidea/ta ... al_05.html
Don't pay too much attention to the contents, typos and font size variations. It is funny to read now.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Tutorials?

Post by BasicCoder2 »

Well you have a web page to put your stuff on.
Writing tutorials can have help you organise your own thoughts just as pretending to teach someone a subject can make sure you have a clear understanding of the subject yourself.
I have a few partial game tutorials on my computer but so far not complete enough to "publish".
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Tutorials?

Post by Imortis »

As a note: My Website is open for tutorials should anyone want somewhere to publish them.
Post Reply