# Help me help FreeBSD



## joseche (May 18, 2012)

During the last years I have only used PHP (with and without frameworks), ajax, etc., but I would like to contribute to FreeBSD (or at least some ports) so I guess the first huge step is to be proficient in C++?

If that is the case, which books/sites do you recommend?


----------



## shitson (May 18, 2012)

Welcome to the Forum; Please refer to this http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/ it's a very good start.


----------



## joel@ (May 18, 2012)

joseche said:
			
		

> During the last years I have only used PHP(with and without frameworks), ajax, etc....
> but I will like to contribute to FreeBSD (or at least some ports) so *I guess the first huge step is to be proficient in C++* ?


C would be a (much) better choice.


----------



## shitson (May 18, 2012)

joel@ said:
			
		

> C would be a (much) better choice.



A strong advocate of C++ is Linus :e hehe

http://lwn.net/Articles/249460/


----------



## joseche (May 18, 2012)

Linus is really an example of someone who can't express ideas in a sound manner. I think disrespect comes when you have other bigger issues to solve yourself.

But coming back to the point, means that all FreeBSD source is in C? For me that is a lot better, easier to understand, but I will like to have a very good book to guide me if you have any recommendation.

Thanks.


----------



## UNIXgod (May 18, 2012)

joseche said:
			
		

> Linus is really an example of someone who can't express ideas in a sound manner. I think disrespect comes when you have other bigger issues to solve yourself.
> 
> But coming back to the point, means that all FreeBSD source is in C? For me that is a lot better, easier to understand, but I will like to have a very good book to guide me if you have any recommendation.
> 
> Thanks.



The classics are good:

The C Programming Language(Kernighan, Ritchie)
and
The UNIX Programming Environment (Kernighan, Pike)


----------



## germanopratin (May 19, 2012)

shitson said:
			
		

> A strong advocate of C++ is Linus :e hehe
> 
> http://lwn.net/Articles/249460/



:e VERY VERY TRUE!

OOP is a terrible concept. It's massive overhead. It comes with a GUI-like mindset, no wonder that the same guys who invented it also came up with desktop metaphores and the mouse. All of this has its place, but you cannot wrap it around everything.

And C++ is a terrible language, that simply cannot fit into a human brain. Tho*ugh* Java is even worse, for it forces you to do everything class-wise. 

All the features that are promoted in OOP are either old stuff with a new hat or pointless. For instance what's the point of polymorphism? Data hiding and data encapsulation are not new concepts - functions provide all of this in a more modest way. What are classes good for? Why pretend that everything is an object, when only objects are. Why attach functions to certain objects? It's just stupid.

The classics mentioned by UNIXgod are perfect for a sound start.


----------



## xibo (May 19, 2012)

The issue of C vs. C++ has been discussed more then often enough already.

The FreeBSD project is a collection of software and all that belongs to it, including man pages, howtos and other documentation that does not require any programming skills to create. Another large part of the project is the ports system. Ports themselves are written in make language, though it might be helpful to understand the language the software that is packaged by them is written in (it's not especially useful to know C if you're trying to port a perl module). Of cause there's the ``code'', too, mostly written in C. However many parts of the development are done out of tree (e.g. the new sort, libstdc++, ... are all developed by subprojects and/or teams that are mostly unrelated to FreeBSD).

McKusick wrote the Design and Implementation of the FreeBSD Operating System, which is a good start into the kernel source if you're interested.

When it comes down to books on programming languages, I don't know any good ones (other then K&R's The C Programming Language mentioned before already). However, knowledge about algorithmics will help a lot independent of what you're programming or in what language you're doing it, and there's a lot of good books on it.


----------



## kpa (May 19, 2012)

xibo said:
			
		

> When it comes down to books on programming languages, I don't know any good ones (other then K&R's The C Programming Language mentioned before already). However, knowledge about algorithmics will help alot independent of what you're programming or in what language you're doing it, and there's a lot of good books on it.



This book is one of the definitive "bibles" of algorithms, it may look intimidating because of rigorous mathematical analysis of the subject matter but I'd say you don't have to understand it all to understand the fundamental ideas of the algorithms presented.

http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844


----------



## fluca1978 (May 22, 2012)

germanopratin said:
			
		

> And C++ is a terrible language, that simply cannot fit into a human brain. Tho*ugh* Java is even worse, for it forces you to do everything class-wise.



While I agree that Java is wors*e* than C++, I don't feel like C++ is so horrible. My opinion is that any language has a context and an aim, and I studied a few languages just to find out that I was approaching them for the wrong aim in the wrong context. Using them the way they are designed for makes them all appear good. Another error I see very often is that C++ is considered C-with-class-stuff, while C++ should be looked as an OOP language with the same C-like syntax.

The truth is that there is no magic language that will win in every context and for every application. Having said that, C is a great language for low level systems, C++ is better at high level systems (e.g., desktop environments).


----------



## kpedersen (May 22, 2012)

High-level, Low-level... C and C++ are perfect for both.

Learn them both and then use whichever one the project uses lol.


----------



## Anonymous (May 28, 2012)

> McKusick wrote the Design and Implementation of the FreeBSD Operating System, which is a good start into the kernel source if you're interested.



I would definitely make sure you understand what is in this book first though: http://www.amazon.com/dp/0131429388...and=933280047847958277&hvpone=&hvptwo=&hvqmt=

C and assembly are the only languages appropriate for OS development. 
C++ and Java are only really useful for user-land applications and both have pro/cons when compared to C in that domain.




If you don't have experience with C or assembly I would read the following books in order:
http://www.amazon.com/Programming-Modern-Approach-2nd-Edition/dp/0393979504/ref=dp_ob_title_bk  (C programming)
http://www.amazon.com/Professional-Assembly-Language-Programmer/dp/0764579010   (Assembly)
http://www.amazon.com/Shellcoders-H...=sr_1_1?s=books&ie=UTF8&qid=1338177810&sr=1-1  (Secure coding)
http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844  (Efficient code)
http://www.amazon.com/Operating-Systems-Design-Implementation-Edition/dp/0131429388  (Operating system basics)
http://www.amazon.com/Design-Implementation-FreeBSD-Operating-System/dp/0201702452  (FreeBSD design specifics)
http://www.amazon.com/FreeBSD-Devic...=sr_1_1?s=books&ie=UTF8&qid=1338177444&sr=1-1  (Optional: for drivers)
http://www.tcpipguide.com/  (Optional: for network stack programming)


----------

