Roman mosaic floor found under Italian vineyard - <AUTHOR> https://www.bbc.co.uk/news/world-europe-52818746 <comment><USER2> I found many remnants of Roman mosaics in Tunisia; they seem to be everywhere. They are especially easy to find along the beaches because even the individual stones stand out. They have a small square shape that is unlike anything else you are likely to see. I suspect they were from the private homes and villas of wealthy Romans. The largest one I found was over 2 square meters, but I did not invest much effort searching. Back in those days, I had more interesting things to do with my time on the beach.

Two thousand years ago, the mediterranean was a much different place. Today much of Tunisia seems barren, but one peek at the El Jem Amphitheatre and you know things have changed. Tunisia was once a verdant agricultural land with a booming economy that supported the building of sumptuous homes, outdoor theatres, public baths, temples, enormous aqueducts, etc. [http://www.tourismtunisia.com/historic-sites-in- tunisia/](http://www.tourismtunisia.com/historic-sites-in-tunisia/)

<comment><USER3> You understate what Tunisia once was; it was once, basically, _Carthage_ , the richest city-state in the world and the center (or one of the centers) of several of the most advanced civilizations in the world--the Phoenician, Carthaginian, and later Roman Empires. Carthage was razed during the Arab Conquest so the Romans would stop attempting to take back the region. A more modest city was rebuilt nearby but the region never came close to achieving its former glory.

<comment><USER4> Carthage and Corinth were Rome's primary competition. Carthage's final fall coincided with Corinth's, but its history with Rome dated back much much earlier. Roman artifacts are a relic of their occupation and rebuild of the city. And you're correct with the notion of the Arab/Muslim conquests. An amazing city that was reduced to a fraction of its former glory. That such a well-preserved artifact has been preserved is quite an amazing discovery. I'm pretty excited by it.

</comment></comment></comment><comment><USER5> From what I understand, this happens in Rome all the time. Their subway system encounters a work stoppage due to stumbling onto a new buried building on like a weekly basis. Rome keeps sinking and so there are layers upon layers of buildings on top of each other. While there last May I went to a 14th century chapel they was on top of a fourth century chapel, on top of a send century chapel, on top of a first century villa, on top of an old mint. There is an underground river that would need to be diverted to see if there is something under that but it appears there is.

Fun thing I saw there: this is where St. Cyril was buried and above his tomb there are about a dozen plaques thanking him for bringing literacy to places like Ukraine, Macedonia, etc. Despite them being centuries old I could read them almost perfectly since I can read Russian and Ukrainian. That was incredible.

<comment><USER6> Ah, I believe you are referring to the Basilica of St. Clemente [1]. I agree, it's one of the most stunning places you can find in Rome!

[1] [https://en.m.wikipedia.org/wiki/San_Clemente_al_Laterano](https://en.m.wikipedia.org/wiki/San_Clemente_al_Laterano)

<comment><USER5> I was! It really was an amazing place. I absolutely fell in love with Rome while there.

</comment></comment></comment><comment><USER7> Many more, better, photos [https://interestingengineering.com/stunning-roman- mosaic-flo...](https://interestingengineering.com/stunning-roman-mosaic-floor- found-intact-under-a-vineyard-in-italy)

<comment><USER8> I can't even imagine how many discoveries like this are buried in Turkey, having been the center of the east Roman empire for a thousand years.

I wish Turkey would allow archeological digs.

<comment><USER9> They do allow digs. Turkey, as a nation, just isn't as enthusiastic about archaeology as one might hope. This might be due to some unfounded perception of themselves as "invaders".

To this day, many Greeks, Russians, etc. (mainly Eastern Orthodox Christians) still refer to Istanbul as Constantinople, as though it is under some form of illegitimate occupation. The West also still seems to view the fall of Constantinople as the fault of the Turkish people. Is it hard to blame the average Turkish citizen for being less then enthusiastic about exploring the history of what everyone around them views as _somebody else 's_ historical legacy?

This all ignores the fact that the Eastern Empire declined steadily for centuries and lost territory to many other peoples besides the Turks, including both Greeks and Europeans. While we may view the conquest of Constantinople as the tragic end of the Roman empire, the fact is that the empire lived on in the institutions of the Ottoman empire and in its people. The Ottoman empire absorbed populations that were once Roman and, although their descendants today may adhere to a different religion, their culturual inheritance is still, in large part, Roman.

This alienation of Turkish citizens from their heritage is now causing serious problems. Erdoğan's regime holds commercial interests to be supreme and has not hesitated to throw important sites under the bulldozer over minor delays. Roman ruins are widely viewed, not as the people's heritage, but as a foreign nuisance that is best swept away to make room for the new. This must change.

<comment><USER10> That is really sad to hear. Regardless of the past, archaeological ruins are collective humanities' shared treasure and must be preserved.

Somewhat OT, I wonder if there's a way to teach history that wouldn't make people's dislike it just because of perceptions like this. The Roman and Ottoman empires don't exist anymore, what do people get my being angry at states that are gone?

</comment></comment></comment></comment><comment><USER11> We take beautiful art for granted today, but imagine how breathtaking and inspiring it must have been for an Ancient Roman to see these mosaics, in a time when beautiful art and artistic form had not yet been commoditized as they are today.

<comment><USER12> Oh, but it was conmoditized even then. Roman society was suprisingly "modern" on many fields, and their approach to art was no exception. Rich paid the creators to create such art on their properties to increase their value.

<comment><USER13> Yeah but it was more like "Kanye West paying someone to paint his crib" than "'middle-class couple hiring a local guy to do up their flat". Rich people were few and far between.

<comment><USER14> Fine art was available to more of the population than you'd think. The world population doubled in the past 45 years. In contrast, during the Roman period, the world population took about 500 years to double.

Wealth accumulated over generations. In that time, if your great-great-great grandfather had a piece of artwork, there was a good chance it was yours now.

We have negative stereotypes of the past, and there were periods of history when that was true, but there were advanced periods too. The Bronze Age empires were pretty impressive until roughly 1300 BC. We had a dark age for a while. The Roman Empire was very impressive. Then we had a dark age for a while.

And you also want to think of the social structure. Rich people employed poor people in households. Even if I owned nothing personally, I'd be exposed to art in my master's household.

<comment><USER15> Except something like 98% of the population were farmers and most of them were never allowed into a rich man's house

<comment><USER16> More like 70% to 90%, just the city of Rome got up to 750k-1M people let alone all the other cities in the empire. A great deal of this was due to Egyptian farmers ability to grow multiple crops per year on the same land. Fishing was similarly extremely productive in terms of labor to food production.

<comment><USER17> I remember reading somewhere that urbanization in Roman Empire was higher than before and after. Like 20% or something.

</comment></comment></comment></comment></comment></comment></comment><comment><USER18> As someone that just spent over 10K on a botched marble floor job. This just pissed me off more at my installer. The guy didn't level the floor. Told me he had 10 years of experience laying tiles. He had 1 by 2 foot tiles, took over a month to lay down 1000 sqft. Not even mosaic. I feel drunk walking on the floor, since it goes up and down so much.

<comment><USER19> Check out the floor of the Pantheon, in Rome. THAT IS THE ORIGINAL FLOOR. People have been walking on it for 2,000 years and it's still gorgeous.

The sheer competency of these guys was unbelievable.

<comment><USER20> So I wanted to check out a picture to see what you were talking about - incredible to imagine building something that last so long looking so nice, really: [https://upload.wikimedia.org/wikipedia/commons/2/2a/Einblick...](https://upload.wikimedia.org/wikipedia/commons/2/2a/Einblick_Panorama_Pantheon_Rom.jpg)

But the woman and man in the lower right of the picture are weirding me out. It seems there are two men almost identical walking one in front of the other, next to two women who also look almost identical walking one in front of the other - but the woman's clothing has changed colors. I'm assuming it is some panorama software weirdness as I see other strange artifacts, but changing the colors to give the impression of different people following each other is... interesting.

<comment><USER21> Wait until you notice half of her torso in the dead center of the photo.

<comment><USER20> Hah, yes I saw that but that makes more sense to me as a panoramic artifact. The duplicated woman with different colors seems like a (possibly ML-driven?) attempt to make a more "realistic" looking photo.

</comment></comment></comment></comment></comment><comment><USER22> It looks there are about 4-5 feet of earth of the mosaics. I know it has been thousands of years, but where did the earth come from? Did it move there naturally from some place higher up? Is it flood debris from a nearby river? Was it placed there by people?

<comment><USER23> I am also amazed by amount of dirt, not by the fact it is covered (it came by process of top soil formation ); but by the sheer amount of it. If that was just after 2-3 thousand years, it makes me wonder what other things can we dig which are much deeper? But again not prehistoric kind of deep, more in range of last million years.

<comment><USER24> Umm fossils maybe?

</comment></comment></comment><comment><USER25> If you like this stuff, I recommend checking out the UK show 'Time Team'. Each episode they do an archaeological dig spanning three days, to see if they can piece together what was going on in a particular site. Many of their digs are on old Roman sites in England.

There's 17 seasons of it, most of which is on Amazon Prime (I think youtube has episodes as well). It's been my goto show lately for interesting entertainment during the pandemic.

</comment><comment><USER15> Just a reminder (I think it has been posted here) of this wonderful read about the many layers of Rome:

[https://www.exurbe.com/the-shape-of-rome/](https://www.exurbe.com/the-shape- of-rome/)

</comment><comment><USER26> I watched a lot of old Time Team episodes lately and this looks like more of the same from the era. Really nice, complex looking work but overall what can be expected for the time period. Cool that it's so well preserved though and hasn't suffered from having a plow or seismic event turn it into a puzzle.

<comment><USER27> I worked on an episode as part of a team reconstructing a mosaic a couple of decades back. (Basildon/"The Intercity Villa")

Unfortunately, it turned out that the GWR railway line had obliterated the original villa. :(

</comment></comment><comment><USER28> It's remarkably well-preserved! Aside from some fading and needing some polish, it's impossible to believe it's really that old. The "resolution" (to use a modern turn of phrase) is much higher than I would have expected for something that large.

<comment><USER29> You made me laugh because people used to describe pixels in terms of mosaic tiles. Now we've got to the point where we do the opposite and descrive mosaics in terms of pixels.

<comment><USER30> In the entrance of the Pokemon Company International in Bellingham, WA, one wall is decorated with an image from one of the games, blown up so that the pixels are 1" x 1", filling a space that's about 20' x 10' tall. What makes it cool is that a transparent tile was put over it, where the tiles are 1" x 1", making the whole wall look like a mosaic, giving something totally modern a wonderful antique air.

<comment><USER31> Do you have a link to a picture of it? I can't seem to find one.

<comment><USER32> I'd love to know if this is it, and if there's a better picture of it. [https://media.glassdoor.com/l/74/a2/5e/2a/pokemon.jpg](https://media.glassdoor.com/l/74/a2/5e/2a/pokemon.jpg)

<comment><USER30> Yeah, that's it, between Bulbasaur and the people sitting down. Here's the picture I took of it the last time I was there: [https://pasteboard.co/JauAUWV.jpg](https://pasteboard.co/JauAUWV.jpg)

<comment><USER28> That's a much better picture. I'm surprised there aren't pics of this available on Google, if it were my HQ, I'd want to show this off!

</comment></comment></comment></comment></comment></comment></comment><comment><USER33> Kind of curious how they found it(surveyors). Did they use ground radar or something to find anomalies in the soil/bedrock. Probably not something you can do from a satellite right(scifi ha).

<comment><USER34> The site was actually known since 1922, but the exact location had been lost.

Last year they started digging again and the first parts of the mosaic floor had been uncovered.

<comment><USER13> I'm surprised they are doing it right now, with all that's going on in that area too.

<comment><USER34> The activity on the site had been interrupted in February due to the lockdown, and it restarted this month after the restrictions have been gradually eased up.

As you work in the open air, it's certainly less risky than a closed space (like, say, a haidresser).

</comment></comment></comment></comment><comment><USER35> Incredibly beautiful!

</comment><comment><USER36> How old is the mosaic? article doesn't say and I'm curious since there's a cross motif and wondering if popular theme (coincidence) or post-Constantine Christian imagery.

</comment><comment><USER37> "This damn rocky soil is playing hell with the tiller!"</comment>


Ask HN: Improve C language skills after K&R? - <AUTHOR> I've already read and understood K&R. At work I write rails code and deal with challenges like large databases and scaling large codebases. I was thinking about doing Project Euler problems or cryptopals.com in C. Any other ideas?<p>My objective is to better understand how computers work, how ruby works, and generally to be a better software engineer. <comment><USER2> You could try to make a non-trivial application in C, such as something using IPC / sockets. You could try to make a game. You could try to make a UI application using GTK or similar UI framework. You could start contributing to an open source project (there are so many official GNU C projects). You could try to write a server that implements a simple protocol from the RFC (such as socks5)[0].

Also look into C build systems like cmake or autotools.

[0] [https://www.ietf.org/rfc/rfc1928.txt](https://www.ietf.org/rfc/rfc1928.txt)

</comment><comment><USER3> I would love feedback on this. I wanna take a secure software design course and my C is lacking. Everyone recommends Learn C the Hard Way.

[http://c.learncodethehardway.org](http://c.learncodethehardway.org)

tptacek, who is obviously hot stuff here on HN for his infosec knowledge, recommends this book on Amazon favorably on his recommended InfoSec reading list.

C Interfaces and Implementations: Techniques for Creating Reusable Software

[https://www.amazon.com/review/RMXKDJNH8UOPU/ref=cm_cr_dp_tit...](https://www.amazon.com/review/RMXKDJNH8UOPU/ref=cm_cr_dp_title?ie=UTF8&ASIN=0201498413&channel=detail- glance&nodeID=283155&store=books)

He said it is the most advanced C book in existence. If only I had enough time to not only read but understand it all! Haha.

<comment><USER4> How is this?

Some random guy suggested this to me to take my C to the next level: Expert C Programming: Deep C Secrets

[https://www.amazon.com/Expert-Programming-Peter-van- Linden/d...](https://www.amazon.com/Expert-Programming-Peter-van- Linden/dp/0131774298/)

<comment><USER3> I mean I laughed. But yes, tptacek worship, even from wannabes like me, is annoying (perhaps even to him).

My point was can someone steer us to good materials. I proferred what I heard hoping others would correct me and other posters.

I like the premise of LCTHW. Why not show me small projects that are simple to compile, but sucky and basic, and ask me to gradually fix him.

I went through a few chapters, and it is good. I am just lazy. But the projects are small. If somene fleshed this out into something more thorough, it would help sucky learners like me everywhere!

<comment><USER5> Yeah, it's pretty weird.

CII is a great, great C book though.

</comment></comment></comment></comment><comment><USER6> The Peter van Linden book: _Expert C Programming_ is old but nice:

[https://www.google.com/search?q=expert+c+programming+deep+c+...](https://www.google.com/search?q=expert+c+programming+deep+c+secrets+pdf)

...you may also enjoy:

[http://www.gowrikumar.com/c/index.php](http://www.gowrikumar.com/c/index.php)

[http://blog.regehr.org/archives/213](http://blog.regehr.org/archives/213)

...and learn to use a memory error debugging tool like:

[http://elinux.org/Electric_Fence](http://elinux.org/Electric_Fence)

[http://valgrind.org/](http://valgrind.org/)

...Besides C, other ways of expanding your horizons would be to learn things like: Prolog, Lisp, Haskell, and/or Verilog.

<comment><USER4> First link doesn't seem to work?

<comment><USER6> Replaced it.

</comment></comment></comment><comment><USER7> Make sure you have a good understanding of the standard library - in C, this should _not_ be thought of as a black box (because, unlike in some languages, it is written in the language itself, and also it's rather small and minimal).

You should familiarize yourself with the source for a C standard library (not necessarily the one your're using, maybe uclibc, something simple), and work towards being able to implement the functions yourself. For some functions like malloc(), printf(), etc, understanding the implementation tradeoffs will help you understand problems with your own code.

<comment><USER8> As someone who has only casually dabbled in C I found "C: A Reference Manual" [1] a great companion to the "Expert C Programming" book. The typography is dull but the content is excellent - all the details about the language standard and libraries are there while remaining concise enough to serve as a reference book.

[1] [http://careferencemanual.com/](http://careferencemanual.com/)

</comment></comment><comment><USER9> Start learning 8086 or more commonly known a x86 Assembly... That will get you much closer to the hardware and will give you entirely new sets of problems to solve and an immense knowledge of how computers work.

Guaranteed to make you a better software engineer.

<comment><USER7> That sounds like more of a way to learn x86 assembly than a way to learn C. For all we know, this guy is writing his C for an ARM or a m68k - who knows?

<comment><USER9> the OP says "My objective is to better understand how computers work, how ruby works, and generally to be a better software engineer." I just gave him options.

</comment></comment></comment><comment><USER10> Personally, I've always enjoyed doing low-level programming. You may consider looking at writing homebrew games for older consoles, or OS development. Both of those would require you to expand your C skills, and would give you an intimate understanding of how computers work.

</comment><comment><USER11> My recommendation would be to work through _Computer Systems: A Programmer 's Perspective_ [0] if you're comfortable with K&R.

David Hanson's _C Interfaces and Implementations_ is also excellent.

[0] [http://csapp.cs.cmu.edu/](http://csapp.cs.cmu.edu/)

</comment><comment><USER12> Implementing some dynamic data structures should give you a good understanding of how pointers work and allocating and freeing memory. Start with linked lists, then binary trees, then B-trees if you have time. Priority queues (heaps) are fun too.

<comment><USER13> Exactly this. Implementing low-level algorithms focuses on C's strengths: arrays (memory layout) and manual memory allocation. They will be your biggest blind spots coming from a dynamic language, and they are the primary reason one would use C.

After that I would move on to implementing something like a telnet or simple HTTP server, focusing on using sockets and processes _correctly_ : handling all error cases, ensuring no deadlock, etc. That is C's other strength: it is the language of Unix.

</comment></comment><comment><USER14> I'd recommend Ben Klemens' excellent book "21st Century C - Tips from the New School" [0]. This book teaches you modern C techniques and, most importantly, the tooling that modern C programmers use (git, autotools, valgrind, etc.) It also covers commonly used libraries to help you from reinventing the wheel (GLib, POSIX standard, SQLite, libxml, & cURL.)

As mentioned in another post, David Hanson's "C Interfaces and Implementations - Techniques for Creating Reusable Software" [1] is a great book, stressing the design of good APIs. This book in particular might help you in your goal to become a better engineer.

On the free side, there's an excellent PDF by Jens Gustedt, "Modern C" [2]. I've not read the whole thing but it seems like an in-depth look at C11.

John Regehr's blog "Embedded in Academia" [3] is a good resource for C programming. You'll learn a lot about weird edge cases and undefined behavior. He also has a recent post about teaching C, with suggestions for resources [4].

[0] [https://www.amazon.com/21st-Century-Tips-New- School/dp/14919...](https://www.amazon.com/21st-Century-Tips-New- School/dp/1491903899/ref=sr_1_1?ie=UTF8&qid=1469742724&sr=8-1&keywords=21st+century+c)

[1] [https://www.amazon.com/Interfaces-Implementations- Techniques...](https://www.amazon.com/Interfaces-Implementations-Techniques- Creating- Reusable/dp/0201498413/ref=pd_sim_14_4?ie=UTF8&dpID=51ICZM63B2L&dpSrc=sims&preST=_AC_UL160_SR125%2C160_&psc=1&refRID=WGSMXGVZT36WNBD0MTY6)

[2] [http://icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf](http://icube- icps.unistra.fr/img_auth.php/d/db/ModernC.pdf)

[3] [http://blog.regehr.org/](http://blog.regehr.org/)

[4] [http://blog.regehr.org/archives/1393](http://blog.regehr.org/archives/1393)

</comment><comment><USER15> Write a chat server capable of handling concurrent clients, and write a front- end client in Ruby.

You'll need a thread-safe FIFO datastructure, such as a queue, handle sockets, define a communications protocol (or borrow one, I'd recommend IRC).

Bonus: This will also teach you more about the Internet protocol suite ([https://en.wikipedia.org/wiki/Internet_protocol_suite](https://en.wikipedia.org/wiki/Internet_protocol_suite)), particularly the Application/Transport layer.

Side-note: Project Euler and cryptopals problems are not well-suited for C, use the right tool for the job.

</comment><comment><USER16> The book: Expert C Programming: Deep C Secrets by Peter Van der Linden

This book is great, full of good code and even better writing.

<comment><USER17> Seconded. I also recommend _C Traps and Pitfalls_ and _The C Puzzle Book_ to improve your understanding of this subtly complex language.

</comment></comment><comment><USER18> > My objective is to better understand how computers work, how ruby works...

Check out Pat Shaughnessy's Ruby Under a Microscope [0].

It gives a nice overview of the internals of MRI. It doesn't cover a who lot of the C code, but references plenty of it and where it can be found in the source code of MRI. Grab the book, the source for MRI, and do some digging.

[0] [https://www.amazon.com/Ruby-Under-Microscope-Illustrated- Int...](https://www.amazon.com/Ruby-Under-Microscope-Illustrated- Internals/dp/1593275277/)

<comment><USER3> Agreed. I was at a Hackerspace years ago that worked on this principle, and wanted to start lower than that.

[http://nand2tetris.org/course.php](http://nand2tetris.org/course.php)

Alas, I left before I could really get into it, and never had the peer pressure to understand a lot of core CS way over my head.

</comment></comment><comment><USER19> handmade hero[0]! Casey Muratori records many hour long sessions where he goes through the steps of making a video game from scratch in C. Practical, hands on experience from a guy who knows his stuff.

[0]: [https://handmadehero.org/](https://handmadehero.org/)

</comment><comment><USER4> Learn secure coding. I think 80% of secure coding is making sure good coding practice are done, and the rest are spotting algorithm/procedural issues (for example, bad crypto isn't exactly "coding practice", but more of a conceptual fault)

</comment><comment><USER20> Do the Pintos projects. You will learn a bit about operating systems too.

That was certainly the moment in my education where I went from shaky to moderately confident about C.

Pintos is nice because there's an extremely thorough test suite already written before you. It's easy to measure your progress (and know when you are done) by the test report. Like TDD, without the pain of you personally having to write the tests upfront.

[https://web.stanford.edu/class/cs140/projects/pintos/pintos_...](https://web.stanford.edu/class/cs140/projects/pintos/pintos_1.html)

<comment><USER21> It's worth noting this will help you greatly with your ability to use C, but it will _not_ be immediately useful if your goal is learning to use C within the context of Unix-like systems. That is, you won't have access to a significant portion of the libraries most people expect. This _will_ teach you how those libraries - and the system software/OS itself - are built.

</comment></comment><comment><USER22> I agree with the recommendation here to read _Expert C Programming: Deep C Secrets_ by Peter Van der Linden.

As for practice: the challenge in learning new tech is always to find a small- scale project that motivates you to build something. As a mostly-Rails developer like you I've found a couple opportunities to write C by building Postgres extensions. Here are my two:

[https://github.com/pjungwir/aggs_for_arrays/](https://github.com/pjungwir/aggs_for_arrays/)

[https://github.com/pjungwir/inetrange](https://github.com/pjungwir/inetrange)

Both of those are used in production systems and had good justification for dropping down to C.

Or here is a tiny patch to the Postgres btree_gist extension that I am hoping to get merged:

[https://commitfest.postgresql.org/10/332/](https://commitfest.postgresql.org/10/332/)

The JSON support in Postgres is still pretty new. Maybe you could write some worthwhile additions for dealing with json or jsonb data? I would just look at underscore.js for inspiration.

Also if you have a collection of personal shell utilities, you could try rewriting them in C. Here is one of mine:

[https://github.com/pjungwir/range](https://github.com/pjungwir/range)

It is for printing a range of numbers like `1, 2, 3`. It is surprising how many features you can add to a tool like that! (It is a bit of a joke, and I have since learned bash gives you `{1..10}`. But something similar could still make a good learning project.)

Perhaps you could also write a ruby gem that wraps some C library. For instance I'm fond of the jsmn JSON parser [1]. Maybe a gem built around that could give performance benefits? Or maybe some way to easily use Protocol Buffers instead of JSON for Rails web requests?

[1] [http://zserge.com/jsmn.html](http://zserge.com/jsmn.html)

</comment><comment><USER23> Really it all comes down to reading and practice. Instead of writing your personal duct tape code in ruby why not try it in C? Sure it will be harder at first but it will make you a better programmer all around. Also reading OS code (like plan9/9front, *bsd, or xv6) will help you learn both how it works, but also how to write better. I don't really do programming problems because they don't give me anything useful at the end other than the knowledge. If I want to practice I'm more inclined to try solving a problem I have in a new way.

</comment><comment><USER24> Help somebody else learn C.

</comment><comment><USER25> You may find the linked note on learning how computers work useful. Basically, I think that the value of knowing C in this respect is rather limited and that there are much better ways to do that. Not to say that C is not worth learning, of course, for its own merit. [https://news.ycombinator.com/item?id=12118980](https://news.ycombinator.com/item?id=12118980).

</comment><comment><USER26> These discussions may be useful:

"How to C (in 2016)": [https://news.ycombinator.com/item?id=10864176](https://news.ycombinator.com/item?id=10864176)

"Critique of 'How to C (in 2016)'": [https://news.ycombinator.com/item?id=10908217](https://news.ycombinator.com/item?id=10908217)

EDIT: Fixed formatting error

</comment><comment><USER27> Do online courses form coursera and edx,and try to complete all the assignments..this helps a lot

</comment><comment><USER28> Learn writing code that uses IPC -> multi-threading -> linux OS -> Kernel

</comment><comment><USER29> In the bad old days, when, from memory and comparison with vast improvements in the later editions of K&R's chapter on pointers etc., the _Lions ' Commentary on UNIX 6th Edition, with Source Code_ ([https://en.wikipedia.org/wiki/Lions%27_Commentary_on_UNIX_6t...](https://en.wikipedia.org/wiki/Lions%27_Commentary_on_UNIX_6th_Edition,_with_Source_Code)) was held by many in equal or greater esteem than K&R. The code has bee implemented as xc6 ([https://en.wikipedia.org/wiki/Xv6](https://en.wikipedia.org/wiki/Xv6)), but I haven't looked at it.</comment>


BuzzFeed Raises $15.5M To Transform The Way People Get Their News - <AUTHOR> http://techcrunch.com/2012/01/09/viral-aggregator-buzzfeed-raises-15-5m-to-transform-the-way-people-get-their-news/ <comment><USER2> Question: Where is the 15 million worth of USP here?

Anyone can throw up a buzzfeed copy in a day, so theres no usp in the site itself...and you're not buying genius talent like with hunch.com, so...

What are these valuations based upon?

<comment><USER3> You don't have to build a fancy web 2.0 user-generated social-local-mobile app to be worth something. As long as someone has created value for a lot of people, then whatever you have built is worth a lot.

PS: from personal experience I find extremely hard to ditch my favourite blogs and news sites, while I ditch my favourite social/mobile/local apps on a regular basis, but maybe that's just me.

<comment><USER2> What keeps you going back to those blogs and news sites?

</comment></comment></comment><comment><USER4> I'm probably in the minority on this, but Buzzfeed has always rubbed me the wrong way with their very liberal dependance on DMCA. They frequently post content created elsewhere, and then call it fair use.

For example I recall a few weeks ago one of their users posted pictures from Lindsay Lohan's Playboy shoot. Naturally the post generated tons of traffic. I fail to see how that's fair use when they aren't commenting on it, and Playboy consequently sells fewer magazines.</comment>


Statement on planned Fourth of July demonstrations - <AUTHOR> http://www.nsa.gov/public_info/speeches_testimonies/3jul13_4th.shtml

<comment><USER2> "NSA does not object to any lawful, peaceful protest."

Come on: is it possible that anyone has felt the need to write this _seriously_ on the corporate web page of the NSA?

AMAZING.

I _hope_ (but I do not know, they do not say) the NSA also does not object to free speech, to private property, to freedom of press, to freedom of economic initiative, to freedom of religion...

EDIT: Come to think of it, it is possible that they had internal conversations like _what are we going to do with these people?_. And then the chiefs said: "hey, we do not object to these demonstrations!".

Scary...

<comment><USER3> Everyone in the NSA swears to uphold the Constitution, not objecting to lawful, peaceful protests should be a no brainer that goes without saying[0]. Hopefully they post this on an internal bulletin board for their employees as well. It would have been nice if they had made a statement to the effect that they will not collect any information on people participating in the protests.

[0] First Amendment excerpt: "... the right of the people peaceably to assemble, and to petition the Government for a redress of grievances ..."

<comment><USER4> It's like saying, "I will not kill you today." The literal meaning is innocent, but the fact that it was stated at all has terrifying implications.

</comment></comment></comment><comment><USER5> This is how I read between the lines and understood their statement: The Fourth of July reminds us as Americans of the freedoms and rights all citizens of our country are guaranteed by our Constitution. Among those is freedom of speech, often exercised in protests of various kinds. NSA does not object to any lawful, peaceful protest but be advised that we will be monitoring your freedom of speech and anything you say or ever had said may be used against you in a secret court of law.

<comment><USER2> Also

"We shall test your American citizenship by tossing a 1% loaded coin. If it shows tails, you are American, otherwise you are a foreigner and can be lawfully, legally, constitutionally, military and otherwise politically surveilled."

It would be good if they clarified that as well.

<comment><USER6> I think this is really one of the most important discussions we should be having as a society. What obligations ought we hold our government to as far as the rights of non-citizens? Right now the obligations of the government to non-citizens is likely very minimal (IANAL, But I'd love to hear a Constitutionalist's expert opinion on this front).

What limits ought we to establish on our government(s) with regard to the rights of citizens of other nations?

<comment><USER7> I think it's better to leave citizenship out, or focus on treating your own citizens. The rest should follow (this is also what Scahill says in the following story): American citizenship does not protect you from targeted assassination.

[http://www.democracynow.org/2013/4/23/jeremy_scahill_the_sec...](http://www.democracynow.org/2013/4/23/jeremy_scahill_the_secret_story_behind)

<comment><USER8> No, American citizenship does not great a blanket protection against being killed by the military while waging war against the U.S. It guarantees you nothing more and nothing less than "due process." What process is "due" (literally, "warranted") is an inherently context-sensitive question. What process is "due" to someone who spent a decade waging war against the U.S. while refusing to submit to the justice system of any country?

<comment><USER4> The trouble with making it context-sensitive like that is, how do you demonstrate that the person deserves the lower standard?

Your question is mis-phrased. It should be stated as, "What process is due to someone _who is accused of_ spending a decade waging war against the US?"

It appears to be to be completely nonsensical to use the gravity of the accusations against a person to decide what kind of trial (or not) they should receive. The whole point of the trial is to _find out_ whether the accusations are, in fact, true.

<comment><USER7> Don't ignore the teenager son who was also a victim, separately. No one in government has been willing to admit that this killing was anything other than intentional.

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> A much more simple explanation of the NSA statement is that press organizations asked for a statement in relation to the protests planned for today (one of which I will attend, as I have mentioned in recent Hacker News comments) and the NSA's press officers provided a statement. Nothing more, nothing less, nothing else. Yes, NSA officers, like all officers of the federal government, take oaths to uphold the United States Constitution. Most take those oaths very seriously and cherish the constitutional system of the United States. I will be out protesting in public this evening (and I don't care who knows that, as I am not afraid to express my opinions on public policy) to indicate my family's support for the Bill of Rights and desire that all NSA programs be overseen effectively by Congress and fully in accord with the law. That said, I don't begrudge the thousands of NSA employees the opportunity to join me in saying that all Americans have the right of peaceful protest and that is a right we can all cherish as Americans.

See

[http://www.aeinstein.org/organizationsde07.html](http://www.aeinstein.org/organizationsde07.html)

for free, downloadable resources in a variety of languages about what you can do to support the worldwide movement for transitions from dictatorship to democracy. Don't be afraid to do your part to make the world a better place.

</comment><comment><USER10> "NSA does not object to any lawful, peaceful protest."

From an organization that spies on the world, that sounds sinister. As in "if we did object, we could do something about your 'lawful' protest."

<comment><USER11> How does that follow? I know the NSA is enemy number 1 around HN right now, but how does saying they don't object to lawful protests imply that if they did object to the lawful protests they would disrupt them somehow?

If my aunt had balls, she'd be my uncle.

<comment><USER12> It's like me telling you that I don't object to you teaching your kids about any particular religion. When the hell did I even enter the equation? It's the implication that the right to protest might even have to be clarified that shows the NSA is either very presumptious about its authority or really is as politically motivated as we all like to think it is.

</comment></comment></comment><comment><USER13> How do we know if the NSA is acting lawfully? Why can't we have better oversight and transparency?

<sarcasm> After all, they have nothing to hide, right? </sarcasm>

</comment><comment><USER6> I'm growing increasingly concerned about the tone here in HN whenever something is posted about the NSA. This statement on July 4th demonstrations is essentially non-news. Why isn't it more likely that the NSA was getting a ton of media requests for a statement and decided to make it official that they wouldn't make a public objection to the protests? I'd like to see us (the HN community) continue to engage in thoughtful discussions, but the reactions I'm seeing right now are distractions from that. Let's not derail the conversation. Stick to facts where you can, request information where you don't have facts, and make your position known on what we would like to see our government(s) put in place to secure our freedoms and protect us. Let's not muddy the waters any further. Happy 4th.

<comment><USER14> Agreed. If the headline was "NSA refuses to comment on the Restore the Fourth protests", people would just comment that the NSA wasn't recognizing the protests, and that protesting would be useless, as the NSA would stick to their current attitude. I really don't know how the NSA could have responded better, besides actually promising to listen to the arguments of the protesters. It seems like a "damned if you do, damned if you don't"-type situation for the NSA. If one accepts that the NSA is /fundamentally/ flawed, which I doubt it is, nothing it says can change ones mind, including a public statement of it respecting people's rights to protest. The fact that it even has to release a statement though is good - it means that the NSA has realized that there is a backlash against their tactics.

I would like of course for the NSA to change some of its practices... but the amount of hate it is getting on HN is ridiculous.

</comment></comment><comment><USER15> I assume they record the IP-address of everyone who visits that page. And then watches activity to/from that IP-address for ten years.

<comment><USER16> I would think the majority of IPs would be dynamic... If you're really worried about it, clone or spoof a new MAC address after powering off your modem. Then just power it on :p

</comment></comment><comment><USER17> I like that they felt the need to preemptively defend their work as "lawful." This feels like a whole lot of doublespeak.

<comment><USER18> Gulags were lawful. It's not doublespeak. The problem is not the NSA, it's the whole system.

If baseball isn't interstate commerce, but growing your own wheat is for your own consumption, you know the whole state is rotten to the core. There is no objectivity it's just do whatever you want and if you're powerful justify it later.

<comment><USER19> If it's ruled unconstitutional, then it wasn't lawful surely.

<comment><USER18> If you can take someone's land to build a mall, I'm pretty sure the court will have no problem with this...

Even if the have a problem with it I'm sure they'll carve out a minor exception, and no one will face any consequences...

</comment></comment></comment></comment><comment><USER20> I like how they called the Constitution a clock

</comment><comment><USER21> That's a nice constitution ya got there.

It would be a shame if anything were to happen to it.

</comment><comment><USER22> Excellent. I thought we were granted the right to protest by God, so at least we know the NSA isn't standing in the way of God. Hopefully they'll let us know if/when that changes and we can assist the NSA in their new set of goals.

</comment><comment><USER23> I don't want to sound apologetic for the actions of NSA as a whole, and those who surely pressured them into those actions, and those that were aware of them but did not object, but I did take heart in the first sentence, "The Fourth of July reminds us as Americans of the freedoms and rights all citizens of our country are guaranteed by our Constitution."

I hope this is a sign that at least some people in the NSA recognize that what happened was an egregious breach of the spirit of our constitution, and the principle of government by public consent. It would be nice if it meant that some of NSA's members welcome, for their organization, public accountability, clear limits on power afforded to them, and recourse for pressure from other parts of the government to violate these things.

Regardless of whether this is just wistful thinking or not, we should continue to bring awareness to this issue, and take action.

I hope the form of this action will be public awareness, peaceful protests, crowd-funding representatives, and holding those elected representatives legally accountable for their campaign promises (because I do not see how we can have a representative democracy if the words of the representatives before they are elected are so divorced from their actions after).

I hope the result will be legal safeguards and public oversight to make sure that no federal agency can violate the constitution, and act against public consent, no mater how secret their mission.

(edited to include the bit about public awareness)

</comment><comment><USER24> Please stay in your free speech zones while 'lawfully' protesting.

</comment><comment><AUTHOR> I bet the NSA is going to love the inbound referrals from "Hacker News".

<comment><USER25> I'm quite certain at least a few NSA members are regular readers. The NSA is not an evil monolith.

<comment><USER26> I don't think that most people who think about it believe that the NSA is evil. But what it is doing for ostensibly good reasons are actions that can be labeled as evil.

But the truth is, it does those activities because the White House says it should, and Congress is ok with it. The NSA will never not obey politicians.

You want change, write to your Congressional representatives. Write to the major party Committees, and tell them that you will only support and donate to candidates that explicitly seek to change the surveillance of Americans. Find your local party headquarters and your convention delegates, and have respect for privacy added to the party platform.

Protesting the NSA is good because it organizes people, but then they need to be targeted where they will have an effect. But any real change will come from the political process. The NSA doesn't object. The NSA also isn't going to change anything because of the protests.

</comment></comment></comment><comment><USER27> "NSA does not object to any lawful, peaceful protest."

But we will be monitoring those that organise and participate, and attach nice little red flags next to their names.

"NSA and its employees work diligently and lawfully every day, around the clock, to protect the nation and its people."

I disagree with only one word of the above sentence.

<comment><USER28> I disagree with two words. :)

<comment><USER16> Or just negate two words ;)

</comment></comment></comment><comment><USER29> Okay. Great. Our rulers are going to allow us to protest. They're not even going to constrain us to a free speech zone. Thanks!

<comment><USER30> > Okay. Great. Our rulers are going to allow us to protest. They're not even > going to constrain us to a free speech zone. Thanks!

If "our rulers" were not going to allow protest, or to restrict the time place and manner, the vehicle for those restrictions wouldn't likely be the NSA anyway, so a statement that the NSA doesn't object is somewhat tangential.

</comment></comment><comment><USER31> Its a little distorted to me at least, that the very people we employ would take a perspective of granting concent to its employers.

</comment><comment><USER32> _NSA does not object to any lawful, peaceful protest._

Especially when it gives us an opportunity to build a geo-associational database of potential troublemakers cross-referenced with surveillance cam data, social media breadcrumbs and other applicable metadata sources.

You know, for the day when things get _serious_.

</comment><comment><USER33> Thank goodness the NSA clarified that peaceful protesting is A-OK with them. Since they have no respect for the 4th amendment it is heartening that they at least retain some respect for the 1st. Of course, the cynic in me realizes that an organization that shreds the 4th would really, really love the 1st, and indeed encourage people to communicate electronically AS MUCH AS POSSIBLE.

<comment><USER34> Without the first amendment how else would yesterday's banal conversations exist to implicate you in next decades' fortieth deadliest planned and thwarted attack?

</comment></comment><comment><USER35> That is the most generic statement ever...

</comment><comment><USER36> " NSA and its employees work diligently and lawfully every day, around the clock..."

That's right, remind us in every public statement of you're constantly 365/7/24 surveillance of our face, speech, writings, and body.</comment>


Download Study , Korea and Eastern Europe fastest. - <AUTHOR> http://chartsbin.com/view/2484

<comment><AUTHOR> Here is the press release: [http://www.pandonetworks.com/Pando-Networks- Releases-Global-...](http://www.pandonetworks.com/Pando-Networks-Releases- Global-Internet-Speed-Study)</comment>


New York City is building 10,000 Internet pylons for free public Wi-Fi - <AUTHOR> http://www.theverge.com/2014/11/17/7235481/new-york-city-to-provide-free-gigabit-speed-public-wi-fi-for-everyone

<comment><USER2> "Gigabit speeds", free access, ostensibly physical-only advertisement for financial support... wow, sounds perfect!

But if it sounds too good to be true, it probably is. What else might these hotspots do? Insert header "permacookies" to enable tracking across the web? Track people physically all over the city by their WiFi broadcasts? Provide realtime session content and user location data to NYPD? To FBI/NSA?

Please excuse my cynicism. Is it really wise to put NYC "in the middle" of your connections _on purpose_? Is it wise even to distribute WiFi points of presence around the city, where they can more comprehensively surveil the population? Are NYC's motives truly so benign/altruistic?

</comment><comment><USER3> Not going to hold my breath. More confidence in Elon Musk launching a bunch of low orbit internet satellites. Now THAT would be awesome...

</comment><comment><USER4> YOU MUST CONSTRUCT ADDITIONAL PYLONS!

</comment><comment><USER5> why not just put the AP's on the light posts?</comment>


Write and Compile Amiga Apps in a Browser with FreePascal - <AUTHOR> https://blog.alb42.de/2017/06/16/do-it-online/ <comment><AUTHOR> Same for Atari: [https://blog.alb42.de/2017/06/18/do-it-online- atari/](https://blog.alb42.de/2017/06/18/do-it-online-atari/)

</comment><comment><USER2> nice</comment>


Bio-electronic device can produce electricity using nothing but humidity - <AUTHOR> https://arstechnica.com/science/2020/02/bacterial-proteins-plus-ambient-humidity-renewable-power/ <comment><USER2> 400W/m^2 would be awesome. Unfortunately, as szielins points out in the comments it's quite a bit less:

"The devices produce a sustained voltage of around 0.5 volts across a 7-micrometre-thick film, with a current density of around 17 microamperes per square centimetre." From P = IV, that's .5 V * 17 x 10^-6 A / cm^2, or 8.5 microwatts per square centimeter, or .085 watts per square meter--much more reasonable.</comment>


Ask HN: How to get started with astrophysics - <AUTHOR> I've been reading a lot of Neil deGrasse Tyson, I watch Sixty Symbols and Deep Sky Videos and since being 10 years old I was interested in space/exploration. Not mentioning all the sci-fi books/movies/games I went over. I feel passionate about it, started my own observations with my first ever telescope (it is great!) and I would like to push it to the next level.<p>I wonder which books/courses are recommended to start with astrophysics more as a science then ad hoc hobby. I've started the edX program https://www.edx.org/xseries/astrophysics but there might be better resources (especially books as I'm more a reader than a watcher). <comment><USER2> Welcome to HN! Normally this isn't the kind of post that HN encourages (try to stick to stuff that gratifies the intellectual curiosity of the community as per [https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html) )

Astrophysics relies on a lot of general physics, so many undergrad textbooks on these topics will be relevant to you. Most textbooks you could want are available on the Genesis Library at [http://libgen.io](http://libgen.io) Thermodynamics and mechanics (especially orbital mechanics) will be important. Choosing a good textbook is important, reviews on stackexchange and other googleable things will help you decide what you want.

It seems like most of your exposure to astrophysics has been fairly "popular science" stuff without loads of maths. Fun to hear about, but sort of surface level. For better or worse astrophysics is a LOT of math. You'll need strong calculus and algebra skills to really understand most of it. Hopefully I don't sound like a pedantic internet prick, I just don't know how old or educated you are. If you'd like to study astrophysics as a science, it might be worth taking a degree in it.</comment>


Microsoft's New Silverlight Already Out  - <AUTHOR> http://www.businessinsider.com/microsofts-new-silverlight-already-out-2009-3

<comment><USER2> I don't mean to sound snide, but does this really matter? Has Silverlight really managed to get genuine traction in the wider tech community?

Genuine question - I've seen Silverlight around the traps on rare occasions, but it seems to be where Microsoft has made a "strategic partnership" rather than a true movement.</comment>


Ask HN: Why is HN Search hostile to Tor users? - <AUTHOR> It forces them to solve of CAPTCHA before they can use the service.<p>The 'regular' users don't have to do this. <comment><USER2> It might be to prevent bots from spamming requests.</comment>


About Tactile Pavement - <AUTHOR> https://veroniiiica.com/2019/03/18/fast-facts-about-tactile-pavement/ <comment><USER2> This site seems like a veritable treasure trove of information on real-world accessibility measures. A lot of fascinating things here that I'm only vaguely aware of.

</comment><comment><USER3> Things have changed a bit since this was invented in the '60s. How about a virtual variation? Embed low power transmitters, e.g. RFID, in the places where you'd put tactile pavement. Visually impaired people can carry a phone that receives the signal and renders them as audio.

This can be far cheaper than tactile pavement and so more widely deployed, more easily updated as the environment changes, and present different warnings to people with different needs ... like people with limited mobility ("warning 5 inch step down in 3 feet") or the unimpaired ("please do not run in this corridor").

With sufficiently accurate location data and ubiquitous networking, the transmitter isn't needed at all. Apps could curate warnings and other location specific info, and you could subscribe to the ones that are relevant to you. If location tech isn't up to the sub-meter resolution, the embedded transmitters could be used to just send their own exact location. Then you feed that to the app to return warnings, etc.

The etc. could include hyper-local ads, making the system self funding.

<comment><USER4> I see where you're going but sometimes the world is better off without every single thing being IoT.

Especially for people with disabilities the world is not a hospitable place. I can't see how a 'modern' version if something as simple as tactile pavement would be any better for the disabled.

There are, for example, people who are both visually impaired and hearing impaired that are capable of guiding themselves around by cane, in these instances tactile pavement is something that I think your 'phone in hand' solution just doesn't work. Additionally, not everyone owns smart phones--even today.

I'm not saying your points are invalid but they're definitely skewed in favor of technology and perhaps a limited understanding of ADA requirements.</comment></comment>


Ask HN: Is there any hope for Research in Motion? - <AUTHOR>

Every alternate day I read someone posting a link here which roughly says "RIM is in trouble".<p>Blackberry is a wonderful phone and I am damn happy with it. Is there any person out here who has anything to say "Good" and "Optimistic" about RIM ? <comment><USER2> They are increasing sales in other countries, just not here. You can say that is a good thing or that other countries are just behind the curve.

You decide.

</comment><comment><USER3> No.</comment>


Ask HN: Does anyone here use OS X as a webserver? - <AUTHOR> We have webservers running BSD, Linux, Windows, but when it comes to OSX, I have only seen people installing server software on it because they do development on it. Does anyone here run/administrate a big website (say with a million users) on OSX? Why did you (or your company) choose OSX? Can you compare it to hosting on other platforms? <comment><USER2> I doubt you will fine anyone who does this today for reasons other than a needing to support legacy software that only runs on OS X for some reason.

All modern web application stacks run as well on Linux as they would on OS X, if not better, so there is no advantage to running OS X and lots of downsides.

You need to run OS X on Apple hardware, and they haven't made a blade server for several years, so you'd be stuck with either the mini or the Mac Pro, either of which is going to be expensive for the computing resources you get. You also can't fit them neatly into an enclosure.

Also, if you ever wanted to move your infrastructure to the cloud you'd need to move to Linux anyway.

I can think of no valid reason to use OS X server to host any kind of web app.

<comment><USER3> > Also, if you ever wanted to move your infrastructure to the cloud you'd need > to move to Linux anyway.

Not true, there are several Mac based hosting companies, offering a mix of physical and virtual servers.

<comment><USER4> Please name one cloud hosting provider who offers Mac OS X.

<comment><USER3> [http://xcloud.me](http://xcloud.me)

[http://www.macminivault.com](http://www.macminivault.com)

[https://www.macstadium.com](https://www.macstadium.com)

There are plenty more choices, those were just the first few I found.

<comment><USER5> Nothing says stuck with a Mac mini like "Mac Mini" Vault :P

<comment><USER3> Before the last refresh, they could actually be quite powerful little servers with the i7 option.

I think a lot of people over-estimate the resources they will require (and either end up paying huge amounts for an over-provisioned service, OR end up locking themselves into an 'infinitely scalable' cloud provider that they never end up scaling.

</comment></comment></comment></comment></comment></comment><comment><USER6> There is an image CDN (EDIT: imgix, as tristanj linked below) which runs OS X for their image processing servers and I've seen pictures of rack holders for Mac Minis for build servers, but in general OS X isn't a very interesting choice.

Running it on non-Apple hardware is legally questionable at best (the EULA forbids it, if this part of the EULA is applicable in your country is a question for a lawyer), Apple doesn't do server hardware anymore, it costs money and you don't get support or special software from Apple for server- usage for it, and since nearly nobody runs it as a server OS it probably isn't very high on the priority list to support that usage for other software vendors or open-source project.

A lot of things probably will work well since they are made to run for developer usage, but if you do not absolutely need integration with something apple-specific or just want to reuse an old mac lying around for a hobby project it doesn't give you anything over other OSes as a normal web server.

<comment><USER7> You're correct in that Apple doesn't manufacture server hardware like the Xserve anymore, but OS X, Server edition is still available and it will manage Apache for you (albeit in a terrible way, I don't like the excessive configuration they apply)

Many of Apple's own web sites run Apple hardware for outward facing, large scale serving (I used to work there).

At the end of the day, Unix is Unix.

I run nginx on OS X on a number of Mac Minis without issue and long uptimes.

<comment><USER8> >Many of Apple's own web sites run Apple hardware for outward facing, large scale serving (I used to work there).

Does that mean Mac Mini? Or Custom Hardware like Xserve.

<comment><USER7> Oh, back then it was a wall full of XServes. These days, if they run Macs, they're probably racking Mac Pros.

</comment></comment></comment></comment><comment><USER9> Not me personally, but Imgix uses Mac Pros in their datacenter for graphics related work.

[http://photos.imgix.com/racking-mac-pros](http://photos.imgix.com/racking- mac-pros)

And not directly what you asked, but a thread that comes to mind is this one, where an unnamed company (presumably Mathworks) built a rack of Macbook Pros for testing purposes.

[https://news.ycombinator.com/item?id=9967357](https://news.ycombinator.com/item?id=9967357)

</comment><comment><USER10> Serving HTTP requests has been commoditised, there is a hundred cheaper, better, ways to serve a webpage. The only sensible case is non-mission critical SOHO scenario where you happen to have a mac mini or iMac idling around and gathering dust otherwise.

</comment><comment><USER11> A few of the continuous integration companies that support iOS/Mac development run fleets of Macs. If you need info, talk to the folks at bitrise.io or CircleCI

</comment><comment><USER12> I would think the main barrier to doing this is the tie-in between the hardware and software. Mac hardware doesn't even really have a "large server" piece. And certainly if they did it wouldn't be very cheap compared to a Linux box. Since basically any software you would run on OSX to run a server you would presumably be able to run on Linux as well (e.g. nginx, etc.), I don't know what the advantage would be.

</comment><comment><USER13> I ran part of a website on OS X. We needed to generate screen captures of URLs back before lots of tools existed to solve that problem, so we had a Mac Mini generating captures and thumbnails. For a very long time they were all generated, stored locally, and served by Apache. Recently (after I stopped working on the project) serving was migrated to S3, I believe just due to disk space issues.

</comment><comment><USER14> [https://macminicolo.net/](https://macminicolo.net/)

An entire colocation facility that runs Mac minis. It looks fun.

</comment><comment><USER15> The only reason why I would personally do that is to run some continuous integration for OSX software. Otherwise I can't think of any reason why one would run a OSX server,which implies owning a Macintosh. Some legacy frameworks like web objects might run better on OSX. At a previous job, we used a server on a mac mini that ran a proprietary software which did 3GP video encoding with DRM. We had to buy a mac mini for that single purpose (+ the cost of the software license).

<comment><USER16> > run some continuous integration for OSX software

I can confirm this (I work at MacStadium). We've got 1. a large number of CI SaaS companies that run their OS X/iOS builds on our hardware and 2. at least several hundred companies that run their own custom build tools or Jenkins on individual or clusters of Mac minis, Xserves, and Mac Pros in our data centers.

</comment></comment><comment><USER17> If you use it, don't install their Server.app unless you specifically need something it does. It takes over port 443 and others forcing you to do things in their way behind their global proxy.

</comment><comment><USER18> We do, but not at the millions of users level. We use it to run a swift proxy server.

We have no interest in scaling on OSX and plan to port to linux. It's an interim type of thing.

</comment><comment><USER19> Ten years ago when Xserves were a thing we ran web servers on OS X, but primarily because we needed OS X for some other server software and it was cheaper to also run a web server on those boxes than stand up a Linux box.

We've since abandoned this practice as there is no Apple hardware suitable for it. We still run some Mac mini servers for things that do not run on any other OS, but definitely not web sites/apps.

</comment><comment><USER20> I did serve a company internal tool written in PHP/mysql from a white macbook. It was served to all our retail locations (under 100 DAUs). It was a "but it works on my machine" \- "back up your email, your machine is going into production" situation. It ended up taking almost two years to migrate the application away because it just worked. Picture of said server macbook [https://flic.kr/p/DY4k1U](https://flic.kr/p/DY4k1U)

</comment><comment><USER21> Edit: Offtopic but interesting.

I definitely don't have millions of users, but there are hosting companies that do mac only. You can ask them if they have large clients.

(My needs are a node.js based site on virtualmacosx.

I had written something locally on Mac, and it depended on things that OSX did different than Linux, and decided I didn't have the time or inclination to fix it, so went with VMOSX.)

<comment><USER16> Hosting company that does Mac only[0] here (I work at MacStadium[1]).

We've got customers of all sizes. It started out with just individual developers and small teams using our solutions so they didn't have to spend capital and IT resources on their own Mac hardware. Many are still here with Mac minis rented or colocated.

Now though, we've got fortune 500 customers, many enterprise tech companies, and a growing number of unicorns joining the service since they can't do internally what we can do at scale in data centers with the Mac Pro. A lot of these customers are using us to test iOS apps with large clusters of dedicated Mac Pros connected to SAN.

[0]: We mostly serve customers that need Mac hardware for app development and CI/CD. We also have HP bladeservers, though, as a few companies have moved their entire infrastructure to our data centers or have migrated from Mac hardware to generic Linux systems and don't want to leave due to certain features we can offer.

[1]: [https://macstadium.com](https://macstadium.com)

</comment></comment><comment><USER22> The only webservice I've run on OSX was a Jenkins webserver to provide an HTTP dashboard for an automated ios app build system running on the same machine. And it was not a pleasant experience at all. I do not recommend using OSX as a webserver unless you absolutely have to (for example to run Xcode builds).

</comment><comment><USER23> I have some OS X machines on the LAN for things like dashboards but I wouldn't dream of using one on production web servers.

I really like OS X, I've been using it on my personal and work computers for 9 years. But for server sit is Linux all the way.

</comment><comment><USER24> IIRC, a few years back [http://iolanguage.org/](http://iolanguage.org/) was hosted on an aging Macbook. I'm not sure if that's still the case.

</comment><comment><USER25> RunSwiftLang.com's Swift interpreter component runs on OS X to make use of the native Foundation libraries. Not a huge app (Ruby/Sinatra) in of itself but fits the bill.

</comment><comment><USER26> I've used Filemaker Server to host it's web interface. I probably wouldn't use it again, but I didn't know of any simple self-hosted alternatives at the time.

</comment><comment> King-Aaron I've spun up OSX Server instances to run 4D databases in the past, nothing in production with the sort of users you're looking at however.

</comment><comment><USER27> I suspect interest in this withered greatly after Apple abandoned Xserve

</comment><comment><USER28> used to have a few Xserves when they were a thing, never a million users though.</comment>


Show HN: Serveo–Port forwarding a la ngrok using SSH, with HTTP inspect/replay - <AUTHOR> https://serveo.net/ <comment><USER2> This is awesome! Definitely going to try this out instead of using ngrok next time I need it.</comment>


Why The Aversion to the Low Hanging Fruits? - <AUTHOR> http://siliconangle.com/ver2/2009/08/25/why-the-aversion-to-the-low-hanging-fruits/ <comment><USER2> I'm not sure if this is intended, but the overlap in your <h2> tags hurts my eyes.

<comment><AUTHOR> That was a design decision, actually. One that gets mixed reception. We're considering changing it.

<comment><USER3> I have to aay it...

.... talk about low-hanging fruit!

</comment></comment></comment><comment><AUTHOR> The conversation unalone and I had last night in the broader context of the unwillingness by Web 2.0 companies seemingly unable to go for the "unsexy" monetization solutions.

<comment><USER4> Is there some reference for the statement that they are failing to chase monetisation solutions because they are "unsexy" as opposed to some other reason?

<comment><AUTHOR> Not in the original conversation, but it's referenced a few times in the post.

Unsexy is my snap judgement as to why it's not being pursued... If there's a better reason why, I'm open to being educated.</comment></comment></comment>


Benchmarking Hosted MongoDB Services - <AUTHOR> http://devops.rackspace.com/benchmarking-hosted-mongodb-services.html#.US4KtqXVUxG

<comment><USER2> I did a little digging and though the article does not name the other providers, based on pricing, I believe Hosted AWS Provider #1 is MongoHQ [1] and Hosted AWS Provider #2 is MongoLab [2]. (MongoHQ no longer has Replica Set: Small on their Pricing page but I found it in the Google cache. [3]).

[1] <https://www.mongohq.com/pricing>

[2] <https://mongolab.com/products/pricing/>

[3] [http://webcache.googleusercontent.com/search?q=cache:cj8DBbH...](http://webcache.googleusercontent.com/search?q=cache:cj8DBbH_iWAJ:https://www.mongohq.com/pricing+&cd=5&hl=en&ct=clnk&gl=us)

<comment><USER3> That's correct, we actually rolled out our SSD backed plans a few hours before the benchmark post. It would likely change their results.

[http://blog.mongohq.com/blog/2013/02/27/now-available- availa...](http://blog.mongohq.com/blog/2013/02/27/now-available-available- SSD-replica-sets-beta-autoscaling/)

</comment></comment><comment><USER4> I'm sure their blog had nothing to do with the recent acquisition of ObjectRocket either :)

IMHO competition in this space is good for everyone so I await more public benchmarks.</comment>


Ask HN: Would you pay for hardened AMIs/VMs? - <AUTHOR>

Do startups harden their own machines? Run stock OS's in production? Is there a perceived value in secured machines? <comment><USER2> Anecdote: A friend of my runs a consulting business. He does webapps, but generally has to set up the webserver if he doesn't have to provide hosting. He's a fantastic programmer. I came to find out that he hadn't disallowed root SSH yet or implemented SSH keys.

With that said, I would say most probably don't unless they have someone with sysadmin experience or likes infosec.

Perceived value? Certainly, if you can convince them that if the data gets corrupted or stolen or you get haxx0red by script kiddies there's going to be a financial consequence.

Will they pay? I don't know. It's risk management between site/data loss and paying to set it up.

</comment><comment><USER3> I'd be interested in having AMIs that cut down on the boot time as much as possible. For example most cluster compute AMIs need at least 3 minutes to boot, by slimming the image and maybe intelligently ordering the filesystem it should be possible to speed this up.

</comment><comment><USER4> I'm surprised something like that doesn't exist...

<comment><USER5> This doesn't exist already? I'd pay for a hardened AMI no question

</comment></comment><comment><USER6> I'd certainly consider it.... especially if it was targeted for specific industries/regulations (HIPAA, SAS 70, etc).

<comment><USER2> I agree with you on this. If I was starting something in a space with regulations I would love to buy something that's guaranteed rather than figuring it out myself. It would allow me to work on my product rather than compliance.

<comment><AUTHOR> The problem is that it can't really be guaranteed because there is no knowing what you are going to do with it. I could give you a hardened AMI and then you could totally open in up in the course of your development. So it would have to be something like "Here is what has been done to it. Here is how it currently satisfies X accreditation. It is your responsibility to keep it secure"

Given that is this still worthwhile?</comment></comment></comment>


Why not inherit from List? - <AUTHOR> http://stackoverflow.com/questions/21692193/why-not-inherit-from-listt <comment><USER3> The various SO answers combined sum it up.

\- Single inheritance means it's unnatural to inherit from the player list which is just one aspect of a team.

\- It's a leak of implementation detail. Tomorrow you may want the team to contain a sorted collection, or a set, or a sorted set.

\- It gives an unnatural syntax to team.count vs team.players.count. Again, composition wins in clarity

\- You can still expose any part of a collection interface in your Team class, e.g. team.Add(player). The details of what this does should be hidden. Adding an interface like IEnumerable<Player> to the team gives a nice syntax like "foreach(Player p in team)" without breaking encapsulation.

\- A list is a simple data structure, a team is not. Extending something to completely change what it is usually means you have an unnatural inheritance. A special list (sorted, cirular...) can extend list in a natural way, a business object should probably "have a" rather than "be a" list.

<comment><USER4> >> Adding an interface like IEnumerable<Player> to the team gives a nice syntax like "foreach(Player p in team)"

It would be interesting to allow _private_ inheritance, i.e. a class inherits methods from a superclass but they're all private and you need to add interfaces to expose them. That way you could inherit an implementation without leaking it into the public interface.

<comment><USER5> C++ does allow private inheritance IIRC, but at that point, why not just use a nember variable?

<comment><USER4> Good point, I suppose it would just be a poor man's delegation really.

</comment></comment></comment></comment><comment><USER6> So the question basically drills down to why one should use composition instead of inheritance. Most OOP languages only allow inheriting from a single class, and that alone is reason enough to prefer composition in most cases. It's one of the reasons I'm particularly fond of traits/modules.

<comment><USER7> Also a best known practice:

[http://en.wikipedia.org/wiki/Composition_over_inheritance](http://en.wikipedia.org/wiki/Composition_over_inheritance)

<comment><USER8> although the two aren't mutually exclusive

[http://en.wikipedia.org/wiki/Decorator_pattern](http://en.wikipedia.org/wiki/Decorator_pattern)

</comment></comment></comment><comment><USER9> The word "interface" isn't in an answer until the 7th one down. The corrupted- OOP straitjacket even suppresses useful terminology!

</comment><comment><USER10> I think his core assumption is wrong in this case, regardless of his feelings towards using List or not:

You count the players on a team, not the team itself: team.count() means nothing Team.players.count() is correct

It would, in fact, be incorrect to even implement a List interface on his Team object

<comment><USER11> I don't think that's correct. He thinks that a team IS a group of players. Just like a list IS a group of items. team.players.count is like list.items.count

But that's a small point, in general I agree that he should not be inheriting from List here.

</comment></comment><comment><USER12> A sports team is a state-machine that evolves in time; a list, or indeed even a value object, doesn't itself express this.

That said, the pithy, smug, common and unenlightening answer is that inheritance breaks encapsulation. But really, that's a terrible reason not to extend a collection class if you really want to. Just remain aware of the trade-offs and do it.

<comment><USER13> Java Lists evolve in time.

</comment></comment><comment><USER14> I think this could be boiled down as: List<T> is a data structure. Anything that inherits from List<T> should be a data structure too. So LinkedList<T> could reasonably extend List<T>, but Team should not.

<comment> V-2 Yeah. That's what Eric Lippert called a mechanism vs. a business object. I like this differentiation

</comment></comment><comment><USER15> If your class users need all the methods and properties __List has, you should derive your class from it. If they don 't need them, enclose the List and make wrappers for methods your class users actually need.

This is a strict rule, if you write a public API, or any other code that will be used by many people. You may ignore this rule if you have a tiny app and no more than 2 developers. This will save you some time.

For tiny apps, you may also consider choosing another, less strict language. Ruby, JavaScript - anything that allows you to write less code.

<comment><USER16> Strictly speaking you're probably correct. But the problem is that OP is giving as an example a team, without strictly defining the expected behaviour of that class, so everyone starts to imagine his own set of behaviour ovverides, invariants, and so on, and in many cases they are right (the salient point of subclassing is method overriding).

The problem really starts when an invariant supported by a superclass is broken by it subclass. For instance, the idea that a player is unique in a team is obvious, so as said elsewhere in this thread, the Add method, whose invariant is to increment by one the size of the list (because duplicates are allowed, and pretty much no predicate other than equality is applicable to a generic type), would be broken by that Team subclass, and thus any function relying on that implicit behaviour (afaik, c# doesn't implement contracts) would break.

That Liksov substituton principle is tough indeed.

</comment></comment><comment><USER17> Do you want to be able to pass in Team for every function that currently asks for List<T>? Because that is what you are stating through the act of subclassing. At some point some part of your program may have a List<T>, but _actually_ have a Team.

For starters, most teams I know don't have cloning technology, and thus can't have the same member of a team multiple times, but List<T> absolutely allows this. There are no restrictions on uniqueness in a List<T>. So then you may proceed to override Add() to first check if the team member is already in the team:

        void Add(Player aPlayer)
        {
            if (Contains(aPlayer))
                return;

           base.Add(aPlayer);
        }

Wonderful! But now you're a List<T> by name only, because you don't actually behave like a List. You don't follow the most basic postcondition of the API. Every single method that adds an item to a List<T> expects the List<T> to be 1 item larger afterward. So basically, you've created a List<T> that has undefined behavior with every existing function that ever calls Add(), because it _doesn 't work the way it was originally sold as working_, so what is the point of going around calling yourself a List? You are a crash waiting to happen. You are not a List, you are a _list manager_.

Now is when someone will probably say, no no no. Subclassing isn't the problem. The problem is you didn't subclass _the right thing_. You should have subclassed Set<T>. Because teams don't have a natural ordering and contain unique players. But now you're just going to run into new problems. Like the fact that you have to check if a player is first in a sane state before adding them:

        void Add(Player aPlayer)
        {
            if (aPlayer.team != null)
                return; // need to be a free agent!

            base.Add(aPlayer);
        }

We can argue whether this should throw, or whether it should do it unconditionally, but the point is that the virtue of needing logic means its not this thing, its something _managing_ this thing. Someone already wrote Set<T> and List<T> code that was almost certainly smarter than you. You wouldn't go poking around their original source to make your program a tiny bit easier to write at risk of ruining other things, so subclassing it is just a way of cheating and only poking around their source only for specific instances, but still causing all the same potential problems for those instances.

Remember, you should ask yourself _" Can I guarantee every function that expects a T to behave exactly the same way when I pass a P instead (where P is a subclass of T)?"_. Almost always the answer is NO, since that's why you subclassed it to begin with! So you shouldn't do it. If the answer is YES, then you've probably only added an ivar or new methods in which case its equivalent to composition. The only thing subclassing gives you over composition is the ability to modify the behavior of existing methods, which breaks contracts with every other part of the code.

<comment><USER18> [n.b: I'm used to duck typed languages, where you can get away with far more shenanigans.]

> "Can I guarantee every function that expects T to behave exactly the same > way when I pass P (where P is a subclass of T)". Almost always the answer is > NO, that's why you subclassed it to begin with! So you shouldn't do it.

The entire point of subclassing is to be able to answer that question "no". By your logic, we should never subclass anything, because it will behave differently!

It seems to me you're not really trying to argue against subclassing here, but rather against making specific container types subclasses of generic containers types with extra logic (that breaks the container's documented guarantees) added, instead of containing the logic and the container as class attributes.

I'm reminded of the basic inheritance examples that show up all over, where Dog inherits from Animal: this makes sense because a Dog is a type of Animal. A Team is neither a type of List<T> nor a type of Set<T>, so it should not inherit from them. A team can, however, contain a roster represented by a List or Set alongside its other data.

<comment><USER17> _> The entire point of subclassing is to be able to answer that question "no". By your logic, we should never subclass anything, because it will behave differently!_

100% Correct, that is indeed my argument: the very purpose of subclassing is contradictory. Subclassing exists solely to mask the mutation of existing behavior, that is the _only_ feature it adds to composition.

Composition is perfectly capable of ADDING and SUBTRACTING behavior, but to modify behavior it must do so _transparently_. You can't for example change the behavior of Add, you must call another method that internally calls Add on a child object and makes it explicit to the user code that the behavior is thus different.

There is no point in having a type system if the types become meaningless through subclass manipulation. I make a class T that has method M with postcondition P. People write functions that accept T with these expectations. When you create a subclass of T that modifies the behavior of M, the existing functions can no longer be trusted to behave correctly -- this is just a fact.

It's not at all just about "container classes". We see this broken behavior all the time in UI classes like UITableView extending UIView. UIView theoretically has a publicly mutable subviews array, but it _stops_ being so by certain subclasses. So all of a sudden you have a UIView subclass that can't be passed in as an argument to functions with UIView parameters. This may be obvious to people familiar with the framework, but to novices, it now becomes meaningless to see the parameter UIView. Maybe it will do the right thing, maybe it won't, depends on the subclass. Now you have to go read the documentation (hopefully its documented).

The reason inheritance is taught with ridiculous examples like Dog and Animal (or even worse, Triangle and Shape) is precisely because it is so hard to find legitimate examples. You always end up just overriding things like Speak() (which does nothing in Animal and prints "woof" in Dog). "Good" (re: concrete) examples are usually really convoluted and hard to understand (or end up being basically just interfaces like NSResponder which is 99% empty methods).

Duck typing environments are saner in my opinion because they are really just interfaces. You are not making the strong statement "I am an X" (and thus creating the expectation of static behavior), but instead "I have loose behaviors A,B, and C" (in the same way as interfaces).

<comment><USER19> I came in expecting to fully agree with you here, but I think I see a flaw in your logic, unless I'm misunderstanding you.

> Duck typing environments are saner in my opinion because they are really > just interfaces. You are not making the strong statement "I am an X" (and > thus creating the expectation of static behavior), but instead "I have loose > behaviors A,B, and C" (in the same way as interfaces).

I've taken this to mean that you should not subclass unless you can guarantee that the external behavior will be the same, i.e. you will always get the same output for the same input, although its performance characteristics may be different. This contrasts with implementing an interface, where you can return different results, as long as the results are valid. Just trying to paraphrase at this point -- tell me if I'm misrepresenting you.

Where I'm confused is trying to figure out why a violation of the former property would be an issue. If your code block instantiates a subclass, then it knows it isn't dealing with the base class, and it expects the behavior of the subclass -- no problem there. However, when you write a function that asks for the base class as a parameter, that strikes me as a law of demeter violation. The function should not care what the passed object does, as long as it does it legally.

At the risk of straw-manning, I assume your response would be that you should be asking for the interface in that case, not the class. And that is my point. You should never need a particular concrete data type, although you might ask for one to avoid the boilerplate of creating a thousand one-off interfaces.

So this gets back to what people are actually trying to do by subclassing List<T> or Set<T>. They want a good default implementation of IEnumerable<T>, IList<T> or ISet<T>, but with some of the behaviors switched out. They'll still fulfill the base interface requirements, and that's all any other function should ask for, so really, what's the problem?

<comment><USER17> I knew that sentence would require a much longer and deeper discussion (and I was hoping not to leave OOP to explain it). But in a nutshell, to me interfaces are meant precisely to represent "unknown behavior" and classes for "known behavior".

If we take a second to temporarily forget classes altogether and look at functional programming, you may have something like map(). map() takes a list (well known construct) and an iterator function (unknown outside behavior). The API itself makes it clear what can be changed and what can't. The scope of what is dynamic about the function and what isn't is immediately obvious from the types themselves, completely transparent.

To me, interfaces serve this same role in non-functional programming: they represent outside and dynamic behavior. Classes on the other hand represent known behavior. The problem with "good default implementations" is that they mix these two (opposite) concepts together, which regularly leads to completely "consistent" but absurd outcomes, that are usually attempted to be fixed with language-bandaids. Let me provide two examples.

The first is NSArray and NSMutableArray in Cocoa/Cocoa Touch (apologies for the use of these, it is my strongest background, and ironically enough, one of the closest "correct" subclassing examples in my opinion). NSMutableArray is a subclass of NSArray. This makes no sense. Granted, it makes complete sense from an "implementation" view, but when it comes to user code it makes the classes meaningless: if I make a method that takes an NSArray, the whole point is I'm saying its immutable. But I can pass in a mutable array and none of my expectations will be valid: the array could change right under me. And yet the compiler will be perfectly happy because it is a correct statement, NSMutableArrays _are_ NSArrays. This should theoretically be an edge case: using a subclass to provide the OPPOSITE behavior of the original superclass, rendering the type-system absurd, and yet it is a widely used construct. I am thus forced to defensively copy the immutable array because it may very well be a mutable -- something completely "consistent" in this world. This to me shows this fundamental confusion of interface vs. classes. To get back to what you were saying, the problem with subclassing is precisely that it is incredibly difficult to state what is done "legally".

If you have a pure interface, with no existing "default" behavior, its just like a lambda: anything goes. If you have a class, its static. If you have both (subclassing), it gets incredibly tricky and hard to predict the interaction. The entire API of the class becomes surface area for mutation.

Now let me give you the second example: UIView. UIView has a -subviews method. Why can't I override -subviews to return a static list of views if I never want it to change (thus rendering addSubview: and removeSubview null)? The documentation does NOT list this method as non-overridable (And many people in fact override it to do perfectly legitimate things btw). And if I do override it, I still abide by all the postconditions of the method as defined by the API. And in fact, OTHER parts of the framework totally allow (And sometimes encourage!) this type of "override instead of setting"-style programming. As a novice using the framework, its a completely logical expectation that this should work. So why does UIKit completely break down?

Because the real postconditions are incredibly more complicated than just "Return your subviews". You have part of the code written as if nothing will ever change (internally UIView relies on the _subviews ivar), but another that acts like an interface advertising that it might change (possible UIView subclasses). And half the time, the changes don't upset any delicate balance. But other times, it does. Things like a final keyword wouldn't fix the above problem because again, sometimes its legitimate to override. You can absolutely start writing your code in such a way where things "should" work no matter what method a subclass overrides, but that is very hard to get right (and very hard to test), whereas you get this for free by just forcing everyone to use the external interface! (This is what is meant by breaking encapsulation: you work so hard to provide a sane API, that then anyone can break by changing in otherwise completely legitimate ways). The real problem is that you are saying two contradictory things. What you actually want is to do ONE of the following:

1\. Force everyone to use addSubview: and removeSubview: since its a concrete class in a hypothetical non-subclassable Objective-C world. No absurd results because, again, everyone is using the API you worked so hard on and properly tested (i.e. there is no way to futz around with -subviews) OR

2\. Have -subviews be a method of some sort of Drawable interface, such that every other piece of code is now known to work with the expectation that it calls that instead of some internal ivar or something, allowing all the shenanigans you want.

Hopefully that makes my views a little clearer, but I'm super tired since its 2AM here so perhaps some of this was more verbose or not as clear as it could be.

</comment></comment></comment></comment></comment><comment><USER20> When I encounter OO beginners, I often have them check out the SOLID principles:

[http://en.m.wikipedia.org/wiki/Solid_(object- oriented_design...](http://en.m.wikipedia.org/wiki/Solid_\(object- oriented_design\))

I think this person is violating at least 4 of them.

<comment><USER21> I feel OO is so much prone to be misused it's not even funny, exactly because of this.

Or creating a "Human" class inheriting from Body, Arm, Leg, Head

Inheritance also makes TDD a pain in the behind (my opinion) it's not even funny.

<comment><USER20> OO is a very hard art. It took me a good 10 years to be effective at it. But, I learned in the 90s, when there was a lot less knowledge available. These days, it should be a lot easier - so many good resources.

Anyway, I would love to try other ways of doing it. I see functional programming often sold as the better alternative. However, I've never seen a large code base written entirely in functional language.

Anyone have an examples of large functional programs code bases that are good to learn from?

<comment><USER22> GHC is written in Haskell. I don't know the line count, but I understand it to be a large project.

<comment><USER23> It was around 140K LoC as of 2011. [1]

[1] [http://www.aosabook.org/en/ghc.html](http://www.aosabook.org/en/ghc.html)

EDIT: I see another poster arrived at a conclusion of 200KLoC from the same source. I'm guessing the discrepancy is about the ~40KLoC which comprise the runtime system.

</comment></comment></comment></comment></comment><comment><USER24> I think it's fundamentally wrong to model a team as a list of players. It isn't a list of players, and having a data structure representing the players as a property of the team seems more meaningful in terms of communicating the idea of team members. Even then, the most useful data structure to represent the member players would probably be a set, in my opinion. Then, the whole history of the team could be expressed in terms of simple operations on that set.

</comment><comment><USER25> > Microsoft did not seal it because sometimes you might want to create a class > that has a friendlier name

I expect multiple-language support may have been a stumbling block here but compromising your API (instead of sealing the class, document it as "you shouldn't subclass this") for something that could be done with type aliasing seems like a really bad trade-off. Is the C# _using_ keyword a johnny come lately, or would it not support this functionality?

<comment><USER26> Yep:

using MyList = List<MyThing>;

The only limitation is that you can't alias generic types, just fully instantiated ones.

</comment></comment><comment><USER27> I'd rather link to the first answer ([http://stackoverflow.com/a/21694054/247441](http://stackoverflow.com/a/21694054/247441)). The "update" section looks like a nice example of how to step back and think about data modeling of this sort.

> a football team seems to me to be well modeled as a collection of historical > facts such as when a player was recruited, injured, retired, etc

<comment><USER28> Reminds me of the tagline for Datomic, a "database of time-based facts".

</comment></comment><comment><USER29> Would be interesting to hear what would be the functional stand on this.

In a way a team may not need the players. Maybe teams are just identifiers, as are players, and we have a list of event relating players to teams. Then a function can get these events and compute the current list of players in a given team.

<comment><USER30> One way of doing it would be to use a record type, one part of which would be the list of players. This is analogous to the composition strategy in OO. You could then manipulate values of that record type using lenses.

The important question is what you actually want to do with this data. The thing that has always seemed crazy to me about OO is how you can have page- long discussions like this one without even talking about what the data is being used for. The notion instead is to "model the real world", which sends you off on a wild goose chase that is almost always unnecessary.

</comment></comment><comment><USER31> IMO the easiest way to poke a hole in the argument is to say: ok, now what happens when you want to add the coach of the team? and the owner? Adding them to the Players list would be problematic considering they're not really players. If you tried to rig it anyway, your Count method would return incorrectly, and you'd have to override it to exclude coaches. While we're at it, where are you storing the team's name? A variable name alone isn't going to help you display that info to the end-user.

Granted, none of this matters if the OP's problem domain stays where they have it now. OOP, however, shines when your domain is subject to change and developers are willing to sacrifice terseness for flexibility.

</comment><comment><USER32> In part, this is a confusion caused by semantics and inherent difficulties with any kind of abstraction. The notion of a 'team' in real life is a very flexible one, and as soon as we try to represent it using a concrete data structure, we're bound to run into problems. The questioner shouldn't be blamed for thinking a team and a list of players are one and the same - <USER2> are many real life examples in which the two are used interchangeably. If anything, this highlights the challenge of OOP: real life objects and their relationships are just really difficult to model in a deterministic way.

</comment><comment><USER33> Is it any harder than this?

        class Team {
            List<Player> players = new List<Player>();
            public void AddPlayer(Player player) {
                // rule checks here
                players.add(player);
            }
            public IEnumerable<Player> Players {
                get { return players; }
            }
        }

Covers SOLID, DDD, the lot.

One should never inherit the list. Encapsulate perhaps but the list is there as a fundamental structure and to inherit from it would break the encapsulation of the domain model you are constructing and increase efferent coupling.

<comment><USER34> One useful improvement: the roster of players should be a set, not a list. Duplicated player bugs become impossible.

<comment><USER33> Excellent point. HashSet<Player> then.

</comment></comment></comment><comment><USER35> Or use a better language ;-). E.g. in Scala you can use the LinearSeq trait, Ruby the Enumerable mixin to get all the benefits without the drawbacks of Java style subtyping.

<comment><USER36> > Or use a better language ;-). E.g. in Scala

You might want to watch Paul Phillips' recent talk:

[http://www.youtube.com/watch?v=4jh94gowim0](http://www.youtube.com/watch?v=4jh94gowim0)

You will probably start changing your mind about whether Scala is a "better" language. Especially on the collections side.

> to get all the benefits without the drawbacks of Java style subtyping.

Actually, the Scala collections have the exact same problems caused by subtyping that Java does (and quite a few more actually, as Paul explains).

</comment></comment><comment><USER37> TLDR: Class hierarchies should only be used for truly hierarchical objects, which is rare. Composition is almost always the correct structure. When in doubt, use composition. You can almost never go wrong this way.

Another way to look at it, by subclassing List, any method that takes a list can also take a Team. That makes no sense. A method that takes a List should take a list of team members.

</comment><comment><USER38> I don't think every player is a single property of team. However list of players is. It is more logic to create an object for team which has list of players, name, etc. Although your example doesn't explain your problem, there may be some cases that we need to inherit from List.

</comment><comment><USER39> Is a football team a _kind of_ List? If not, then it's wrong to inherit from List.

</comment><comment><USER40> Just use extension methods to List. Weirdly no one talks about it.</comment>