Other Programming questions by non programmer.

dalpets

Well-Known Member

Reaction score: 17
Messages: 359

1) What programming code is most used by FBSD developers?

2) Is this the most useful code for a beginner to start off with?

3) Most beginner programming resources seem to use default teaching methods but seem to be silent on the most basic elements that make up blocks of code. Is there a dictionary for these most basic elements.

4) As a teaching tool could blocks of programming code be written in parallel with one's native language & make sense. It would be great if the two could be sensibly linked, even though it might be otherwise boring.

5) What beginner's resource would you recommend for wring fbsd code?
 

ralphbsz

Son of Beastie

Reaction score: 2,299
Messages: 3,207

1) What programming code is most used by FBSD developers?
Kernel and low-level utilities (ifconfig, ls, ...): C. Note that this is a small fraction of the total software that runs on a computer, and also a part that doesn't change much. On the other hand, it is considered more difficult and time-consuming to develop.

Ports: Those are not developed by FBSD developers, but sort of maintained (as part of porting). They are a wild mix of languages.I would be surprised if C (including C++) are the majority; most likely, they are just a plurality.

2) Is this the most useful code for a beginner to start off with?
That is a question that is hotly debated in academic circles: How to teach students programming? My personal choice (which agrees with a large fraction of programming teachers, although by no means 100%): Python.

3) Most beginner programming resources seem to use default teaching methods but seem to be silent on the most basic elements that make up blocks of code. Is there a dictionary for these most basic elements.
Any good introductory textbook will have those explained: if/else, iteration, loops, functions or methods, objects, containers, abstraction, generics, and so on.

4) As a teaching tool could blocks of programming code be written in parallel with one's native language & make sense. It would be great if the two could be sensibly linked, even though it might be otherwise boring.
When you say "native language", do you mean for example French or Russian? There were attempts to create programming languages that are not based in English; I actually used one for COBOL database code in the early 80s (the so-called "K-Schnittstellen" for database interfaces). I have not seen any of these attempts succeed, but I live and work in English, so I'm biased.

5) What beginner's resource would you recommend for wring fbsd code?
No. Do not begin by attempting to write kernel or utility code. It is too hard. Do that once you are a seasoned programmer and have experience.

Your question is like "What beginner's resource would you recommend for running 400m in the olympics, or playing for Manchester City?". That is a silly question. The correct answer is: Do some track and field by yourself, play (as a child) in the local recreational soccer league, and practice.

If by FBSD you mean the kernel: The "black daemon book": Design and Implementation of FreeBSD, 2nd edition, by Kirk McKusick and others. A beginner will not even understand what the book talks about.
 
OP
D

dalpets

Well-Known Member

Reaction score: 17
Messages: 359

in 1) how are version updates written. Is there an open policy on code language & compilation? If so how are they all brought together to make a seamless development standard?

In 4) above I was rather thinking of the religious analogy where different biblical texts are compared verse by verse, page by page. This has been done by professionals in that area, so it's not really a childish concept.
My point is would it be possible to create a similar parallel comparison between code & say the native tongue of English, one that for newbies addresses the mental divide . It would be revolutionary as a teaching aid if it were workable & worthwhile. What do you think?
 

Zirias

Daemon

Reaction score: 1,413
Messages: 2,467

Don't get me wrong, but: Just learn a programming language!

I've been in the business for long enough and there were countless efforts to close the gap between (non-technical) thoughts and implementations (as a program). Trying to express things in a "natural language" is one idea that typically doesn't lead too far. There have been more promising concepts, like easy to use graphical notations of "business processes", or "domain models", a thing that people thought could somehow be used to generate programs by a set of transformations, even during my studies at university. It never worked too well.

A programming language is a formal language. It doesn't allow for even the slightest ambiguity, interpretation means to fully understand it step by step and there's only "right" or "wrong". This will never map to natural languages.
 
OP
D

dalpets

Well-Known Member

Reaction score: 17
Messages: 359

A programming language is a formal language. It doesn't allow for even the slightest ambiguity, interpretation means to fully understand it step by step and there's only "right" or "wrong". This will never map to natural languages.
That sets me straight in short order :). Thanks, I thought there might be much more to it!
 

mer

Well-Known Member

Reaction score: 283
Messages: 481

A lot of programming is opinion and what one has used and is comfortable with.

Your point #4: I agree with Zirias that there is no true mapping between code and natural languages, but in well written code there should be comments that explain or clarify a block of code.
Most good programmers actually leave comments to remind them of the "why" behind complex chunks of code. Why? Because in 6 months they may have to look at the code and that is forever to a programmer.

Languages: the old standards are C followed by C++. C is not that hard to learn, but can be hard to write well. Plenty of tutorials on the web, find one that suits you and follow it through start to finish. C++ is a good next step because it introduces the concept of Objects (lots of more modern languages like Java, Go, etc use Objects as a basic construct).
Java and others like JavaScript are easy to learn and if are interested in anything with the Web, would be good alternatives. Personally, if you know C/C++ other languages are not hard to figure out.

Tools: pretty much any text editor you like works. Sometimes an IDE (Integrated Development Environment) is helpful in the beginning because you can step through code and other things easier.
 

Trihexagonal

Son of Beastie

Reaction score: 2,314
Messages: 2,885

If by FBSD you mean the kernel: The "black daemon book": Design and Implementation of FreeBSD, 2nd edition, by Kirk McKusick and others. A beginner will not even understand what the book talks about.
You can get one free .pdf sample chapter of the book Chapter 4. Process Management but you get the index and preface that describe all the chapters and 130 pages worth of free reading.

You get this for free as in The FreeBSD Project free:

The Design and Implementation of the 4.4BSD Operating System
by
Marshall Kirk McKusick
Keith Bostic
Michael J. Karels
John S. Quarterman
Copyright © 1996 Addison-Wesley Longman, Inc

I can only write markup languages. XHTML, XML, AIML, and CSS.
 

Alain De Vos

Daemon

Reaction score: 613
Messages: 2,071

My advice is learn any programming language. Once you master one language you are capable of asking more specific questions.
Learning programming Pascal is not bad as a start.
It's what I learned 30 years ago at school but it is still valid.
Code:
pkg install fpc
 

astyle

Aspiring Daemon

Reaction score: 370
Messages: 847

4) As a teaching tool could blocks of programming code be written in parallel with one's native language & make sense. It would be great if the two could be sensibly linked, even though it might be otherwise boring.

In 4) above I was rather thinking of the religious analogy where different biblical texts are compared verse by verse, page by page. This has been done by professionals in that area, so it's not really a childish concept.
My point is would it be possible to create a similar parallel comparison between code & say the native tongue of English, one that for newbies addresses the mental divide . It would be revolutionary as a teaching aid if it were workable & worthwhile. What do you think?
It looks like there's confusion between actual code and documentation of it. Yeah, actual code that runs on the metal - that takes mostly English words, but documentation (comments that explain the code) can be written in multiple natural human languages.

The best analogy I can think of to [comparing a Protestant bible with a Catholic bible] is frankly [comparing FreeBSD kernel with Linux kernel]. But this is just too hairy to even consider.
in 1) how are version updates written. Is there an open policy on code language & compilation? If so how are they all brought together to make a seamless development standard?
Keeping track of version updates is a different animal altogether. And if you switch to a different language to do even something simple like drawing a circle ( like going from C++ to ruby or Perl), that's not a 'new version' any more, but a completely separate project.
 

ralphbsz

Son of Beastie

Reaction score: 2,299
Messages: 3,207

in 1) how are version updates written. Is there an open policy on code language & compilation? If so how are they all brought together to make a seamless development standard?

Again, your question is in the context of what you call "FBSD". What do you mean: The kernel, the base OS, or a typical complete installed system, with lots of ports/packages?

For the kernel: AFAIK, the only language in the FreeBSD kernel is C, although some of the code is inspired by OO concepts, so a good knowledge of C++ is advantageous for understanding the code. This is in contrast with Linux, where C++ kernel modules explicitly exist (I've helped write some), and Rust is being allowed into the kernel recently. For the FreeBSD kernel, a style guide exists (I think you find it with "man 9 style"). Those two bits if information are sufficient yo define a policy. For FreeBSD, it sort of doesn't matter, since relatively few people have the commit bit for the kernel, and we can usually assume that they know what they're doing, language and style wise.

For the base system: I think most of the same rules apply, but I'm not sure of the exact style guides for other programming languages (such as sh, which is certainly a relevant component of the base system), nor what other languages are explicitly allowed in the base system for development (I suspect none other than C and C++, given the lack of mandatory compiler / run time support in the base).

For the ports: Free for all, since most code in ports is not controlled by the FreeBSD project.

You are asking "how are version updates written", and the question I answered is "how is the code that goes into updates written", now "how are version updates reviewed, accepted, committed, and distributed".

In 4) above I was rather thinking of the religious analogy where different biblical texts are compared verse by verse, page by page. This has been done by professionals in that area, so it's not really a childish concept.

My point is would it be possible to create a similar parallel comparison between code & say the native tongue of English, one that for newbies addresses the mental divide . It would be revolutionary as a teaching aid if it were workable & worthwhile. What do you think?
The best example of this is literate programming. The extreme case is the source code for TeX (Don Knuth's text formatting system). The source code is written in a programming language that can naturally be printed, and it looks like a book. Calling it "commenting" doesn't even being to do it justice, as the
book explains in fine detail what the code does, why it was written, how its parts relate to each other. To turn the source code into a book, you use a tool called "tangle" or "weave", which converts it automatically into TeX source, and compiles it into book form. You can take exactly the same source code and use the other of the tangle/weave tools, and turn it into a programming language (used to be a dialect of Pascal, today I think it is a very modified dialect of C), which is compiled to create TeX.

Reading the TeX documentation (both as a concise book, sort of like a user's guide, and the actual code) is really an experience. It is one of the two example of the best documentation ever written (the other example is the System 360 Theory of Operations).
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

1) What programming code is most used by FBSD developers?

2) Is this the most useful code for a beginner to start off with?

3) Most beginner programming resources seem to use default teaching methods but seem to be silent on the most basic elements that make up blocks of code. Is there a dictionary for these most basic elements.

4) As a teaching tool could blocks of programming code be written in parallel with one's native language & make sense. It would be great if the two could be sensibly linked, even though it might be otherwise boring.

5) What beginner's resource would you recommend for wring fbsd code?
My personal opinion would be to learn to use and make the best use of emacs . As a programmer you will spend a lot of time in an editor, especially one which has modes to suit every language you might come across. It's difficult to learn, ie steep learning cliff, but a good editor will actually help you to learn the language you are coding in.

Apparently it has a very good python mode if you want to do python programming.
 
OP
D

dalpets

Well-Known Member

Reaction score: 17
Messages: 359

I realize now that my questions have been rather nieve. That has been due to a lack of knowledge of how things work in the world of programming.
I am absolutely delighted with the helpful responses I have received from the community here in their endeavour to put me on the right track.
Let me now try & explain what I was trying to do.

I was hoping to dedicate a non critical computer to the learning process such that I could hammer away with examples of C that did no harm to my main FBSD computers. Just a compiler & armed with a good beginner text or web site & taking copius notes where necessary. Does that seem a reasonable approach or is there more I should consider?

Ralphbsz's comments above resonated with me because I wasn't trying to invent a silly comparison of apples & oranges, rather I rather poorly tried to say I would like a completely flowing English & parallel commentary of coding that amounted to more than just tersely bare comments, ie., just as an aid memoire for its programmer, but rather designed as a more complete learning tool for beginners.

I need to still digest all here that has been posed for my consideration but for now I would ask would it be better to take this journey in a Windows or Unix like environment. Maybe the answer should be self-evident in this space :). If in Unix then would Emacs be my beginner's go-to compiler.

What text book resources do computer science course students at University use to study early stage computer coding today?
 

mark_j

Daemon

Reaction score: 681
Messages: 1,192

Quite a few universities now seem to teach python for OO, whereas previously it was C/C++ . While it's not my preferred development language and is often not taught in computer science degrees (at least to my knowledge), it is a good language to learn programming.

From there, principles of design, implementation and testing experience can be obtained. Once you're confident with logic flow, then perhaps you can move onto C.

If you want to know what universities use, then look at, for example, UniSA and the courses offered for 1st year IT students. The one I looked at was comp1039. https://study.unisa.edu.au/courses/105293/2021.

The book they use is: Gaddis, Tony 2018, Starting Out with Python, 4th edition, Pearson Education

You can buy these books from their on-campus bookstore or even online.
 

kpedersen

Son of Beastie

Reaction score: 1,991
Messages: 2,862

For beginners wanting to learn C, I really recommend The C Programming Language book.

It is a fairly obvious one but I really can't fault it. It is short and succinct. It also has a little taster of history behind the language which is great if you are also a fan of UNIX. Not only that but it can help you to understand the machine rather than just some random programming language some guy has invented.

Just make sure you get the modern (haha!) one with the red ANSI stamp on the front (2nd edition).
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

I need to still digest all here that has been posed for my consideration but for now I would ask would it be better to take this journey in a Windows or Unix like environment. Maybe the answer should be self-evident in this space :). If in Unix then would Emacs be my beginner's go-to compiler.
Emacs would be your editor, llvm would be your C compiler. On FreeBSD it has replaced gcc

You may be interested in reading this. Getting away from GNU/FSF would be a good idea IMV.
 

Zirias

Daemon

Reaction score: 1,413
Messages: 2,467

Emacs would be your editor,
[...]
Getting away from GNU/FSF would be a good idea IMV.
Uhm, you could consider Emacs pretty genuinely GNU: Stallman was involved with the very first Emacs (not for Unix back then), GNU Emacs was the first GNU project, and it's today more or less synonymous to "Emacs".

But then, why avoid GNU, except for prefering more liberal licenses? As for software quality, better assess each piece of software individually.
 

vigole

Daemon

Reaction score: 1,418
Messages: 1,243

This is my story. My first line of code was in a student summer camp program. It was GW-BASIC + DOS 5 + IBM 5150 (2x 5.25 FDD)
I have great respect for GW-BASIC, because it made me to learn trigonometric functions before any of my schoolmates in the mathematics class!
Cut it to the chase, my next move: Pascal 7.0 -> Turbo C 2 -> Turbo C++ 3 -> MASM 5 -> bunch of .NET crap -> Move to my 1st UNIX experience, i.e. FreeBSD.

Now, I'm looking back. Was that the right path? No. Could I start with C or Assembly? Yes. Does Language matter? No. What's important? Algorithm and data structure.

There're similar questions and answers in this Forums e.g. K&R. To give you an alternative: look at these links. Yes, they're branded as NetBSD and OpenBSD recommended reading, but most of them are general and useful for all UNIX OSes. If I want to compose a similar list for FreeBSD, I'll copy/paste all of them. Some of them are old, but who cares, we're talking UNIX! They may give you some ideas.

Recommended reading | OpenBSD
Recommended reading | NetBSD
 

Zirias

Daemon

Reaction score: 1,413
Messages: 2,467

My first line of code was in a student summer camp program. It was GW-BASIC + DOS 5 + IBM 5150 (2x 5.25 FDD)
Hehe. My first line of code was using Commodore BASIC V2 (on a C64, came built into the ROMs), which was just another (earlier) variant of Microsoft BASIC :cool:

It had its flaws, TBH many of them. Still, it was pretty fine for initial learning ;)
Does Language matter? No.
Mostly not, indeed. Even starting with C could be fine, it's a question of how steep you will tolerate an initial learning curve. If you learn "programming", you start with one language, but the goal is to understand concepts. You won't stick with just one language.
 

vigole

Daemon

Reaction score: 1,418
Messages: 1,243

One more thing, if you're confused, or not sure what's the first step, just go the grymoire.com and start with POSIX shell and other tutorials over there. Frankly sometimes the only thing you need is POSIX shell and few other UNIX program, e.g. awk, sed and make. They're good start, and you need some of them, if you want to port programs to the FreeBSD.
 
  • Like
Reactions: PMc

Menelkir

Active Member

Reaction score: 299
Messages: 232

Hehe. My first line of code was using Commodore BASIC V2 (on a C64, came built into the ROMs), which was just another (earlier) variant of Microsoft BASIC :cool:

It had its flaws, TBH many of them. Still, it was pretty fine for initial learning ;)

Mostly not, indeed. Even starting with C could be fine, it's a question of how steep you will tolerate an initial learning curve. If you learn "programming", you start with one language, but the goal is to understand concepts. You won't stick with just one language.
I've started with ZX-Spectrum Basic here and then got into MSX Basic.
Actually everyone should start with basic, pascal or C. Doesn't mean you should be expert on that language, but at least will push you into logic using the right way.
 

Menelkir

Active Member

Reaction score: 299
Messages: 232

started with assembly language on one of these (on punch cards)
http://www.feb-patrimoine.com/english/iris_50.htm (romanian licensed version but ran the french os)

run time errors dumped core on paper (large control data drum printer ) so you can trace the error :)

few years later i got a zx spectrum
ZX Spectrum was a beautiful machine, not only the basic but the tools and stuff available to start programming, sadly that the rubber keyboard doesn't help that much. I didn't had the ones with the proper keyboard.
 

Alain De Vos

Daemon

Reaction score: 613
Messages: 2,071

I learned programming assembler on a C-64 with a 6510 processor.
It was good learning, it has a simple instruction set. Instructions like load accumulator.
And Simon's basic.

On programming, not forget a lot of code is written in Lisp.
 
Top