"Simple" Languages in FreeBSD

Polytropon freebsd at edvax.de
Sat Jul 2 01:21:52 UTC 2016

On Fri, 1 Jul 2016 14:35:53 -0400, Allen wrote:
> On Fri, 01 Jul 2016 08:48:50 -0500
> Brandon J. Wandersee <brandon.wandersee at gmail.com> wrote:
> <*SNIP*>
> [...]
> > Since *nix is your platform, and you're looking for something
> > "simple," I'd have to recommend starting with Bourne shell
> > scripting.[1] Every Unix/Linux implementation uses shell scripts for
> > common tasks, and shell scripting will both teach you more about how
> > Unix-like operating systems work, and save you from being buried in
> > the low-level, highly abstracted, get-your-hands-really-dirty sorts
> > of tasks other programming languages are suited for. The Bourne shell
> > (/bin/sh) is found on all *nix platforms, and anything written in
> > good old Bourne syntax can be interpreted by any other shell (Bash,
> > ZSH, (T)CSH, Kourne...), so it serves as a good starting point for
> > learning how to write scripts for your shell of choice, and your
> > scripts will work anywhere a Unix shell is available. And since many
> > things in FreeBSD---including all the rc(8) and periodic(8)
> > scripts---are written in Bourne shell, learning that will give you
> > insight into how FreeBSD does some things under the hood, and
> > possibly let you change some of your system's behavior with relative
> > ease and without having to hack the operating system itself.
> OK, this is what I'm aiming for as one of my short term Goals. I want
> to be able to customize System Start Up and all that, but also be able
> to write things I can use as well, and that seems like it's exactly
> what I should do. 

This is where basic shell skills are important (and handy) to have.
As the system's scripting shell is a common means of automating things,
you personally can benefit from those skills, as well as gain a better
understanding of what's happening at system boot time.

> Although I do eventually want to be able to Hack on the Kernel, that's
> going to take me some time. It's one of my Long Term Goals. It's one of
> the reasons that I asked my question here, because BSD is one of my
> main OSs of Choice.

For this special field of programming, you should gain understanding
of C, the preprocessor, and Makefiles. Luckily, the FreeBSD sources
are a good learning resource as soon as you've understood the basics.
Just by reading and patching those sources you can have a great
educational "playground". :-)

Many prople will now say: "But C is hard!" Yes, C might be hard to
actually write productive and secure code in, but it's worth trying
to do so. Allow me to explain:

In the past, computers were more simple than today, and it was much
easier to understand what they're doing ...says the guy who had an
U880 assembler in his head when he was young. ;-) Today's systems are
so complicated that understanding lower-level things is not that easy
anymore. Sure, you can use languages like Python, Ruby, PHP, but you
will quickly understand thtat you're operating on a quite high level.
The more low-level stuff you want to do, the more you get into the
domain of C and assembly language. When you arrive there, the "building
blocks" you're dealing with are much less complex, but require _your_
understanding of things to become meaningful.

Furthermore, it's not a bad idea to at least have a look at many
different programming language paradigms: imprerative, functional,
object-oriented... "Obscure" languages like Forth or APL have a lot
to offer, even if you decide not to use them actively, but knowing
them and their concepts will enable you a much broader view of what
does exist and what's possible than a narrow-minded view on just one
programming language. And openness to thoughts is a fundamental skill
to programming. (Again, note that programming != coding.)

Programming in general is not just about reading, thinking, learning
and understanding, it's also about experimenting. Be curious on where
it will lead you. More or less, the journey is the goal when you start
programming, and if there is a useful tool as a result - even better!

> Thank you :) I'll look into these as well. I think I should have
> renamed the thread a little, because "Simple" Was probably not the best
> word to use for this, but again, thanks for replying.

"Simple" depends on what you want to do. As most things in life,
programming starts with a decision, a dream, a thought or a guess.
"What do I want to achieve?" is the question that leads you on your
way to find the (better: "your") proper tool for this job. The more
you already know, the better your choice can be. Of course there can
be a lot of "trial & error", but as long as you learn from it, it's
not a problem. Even if you say (like I often do): "My choice of tools
was bad, I should have been using Perl instead of awk for this task.
But I'm too lazy to recode the whole thing..." :-)

And don't let people tell you that you're "too old" to enter the
interesting field of programming, or you're "not qualified" because
you don't have a CS degree, or "doing it wrong" just because you're
not using their favorite language or OS. "Programming is hard" might
be discouraging, but it's definitely worth it, because as with many
things in life: Reality depends. The "hard" is as individual as "the
best tool" or "the best result".

The things you don't understand you'll not be able to control.
The things you don't control will control you.
The things that control you will eventually make you stop thinking.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list