Jump to content

  • Log In with Google      Sign In   
  • Create Account

Oberon_Command

Member Since 07 May 2003
Offline Last Active Yesterday, 10:17 PM

Posts I've Made

In Topic: Coding-Style Poll

Yesterday, 09:10 AM

I can work with most styles - my gripes with code tend to be related to how a feature is implemented not what the code looks like.

That being said, the basics:
- tabs instead of spaces if I'm working primarily in the IDE, spaces if I have to look at my code in other editors often; this should be consistent throughout the codebase.
- tabs equivalent to 4 spaces
- no snake_case - PascalCase, camelCase, and scope_camelCase are permissible
- either put opening braces on their own line or don't, as long as it's consistent
- closing braces always go on their own line
- braces should be aligned with the scope that holds them, not the scope they define
- all control flow statements must include braces (except switch cases, which are obviously delimited by other control flow statements) to prevent mistakes

Finally:

// don't do this
auto thing = foo();
if (thing) {
}

// do this instead to enforce that the variable 'thing' can only be used if it's valid
if (auto thing = foo()) {
}

 
Heh. If I'd make a set of coding rules it would be snake_case for most things, PascalCase only for concepts (template parameters) and UPPER_SNAKE_CASE for defines/macros. Because I think it's just not ok to simply ignore how the standard library looks like. (Or avoiding the standard library because you don't understand it which seems to be very popular in C++).
 
But a big +1 on if(auto thing = foo())! (Although I dislike the space before the if's opening parenthesis.


In my world, UPPER_SNAKE_CASE is ONLY used for macros. Constants are spelled "k_constantName".

I've tried doing Erlang-style in C++ (PascalCase for "variable" bindings, snake_case for everything else) and I think that style belongs in Erlang...

In Topic: Coding-Style Poll

Yesterday, 09:00 AM

I can work with most styles - my gripes with code tend to be related to how a feature is implemented not what the code looks like.

That being said, the basics:
- tabs instead of spaces if I'm working primarily in the IDE, spaces if I have to look at my code in other editors often; this should be consistent throughout the codebase.
- tabs equivalent to 4 spaces
- no snake_case - PascalCase, camelCase, and scope_camelCase are permissible.
- no class prefixes. IFoo is permissible, but discouraged.
- either put opening braces on their own line or don't, as long as it's consistent
- closing braces always go on their own line
- braces should be aligned with the scope that holds them, not the scope they define
- all control flow statements must include braces (except switch cases, which are obviously delimited by other control flow statements) to prevent mistakes

These ones are optional, but I like to enforce them on myself anyway:
- try to stick to a maximum line length of 100 characters
- if a line goes past 100 characters, it should be split up
- if a function signature or invocation would be split up to maintain the line length, all arguments to the function should go on their own line.
- do not declare multiple variables in the same declaration
- if a template type is long enough to take up significant space or is difficult to remember (eg. std::vector<std::vector<std::pair<std::string, int>>>), create a type alias with a more readable and meaningful name and use that instead

Finally:
// don't do this
auto thing = foo();
if (thing) {
}

// do this instead to enforce that the variable 'thing' can only be used if it's valid
// C++'17 will add syntax to make this work for more than just pointer types
if (auto thing = foo()) {
}

// I saw some id Software code that did this and I'm quite pleased with it
// Yes, it's a pain in the ass, but it makes the code SO much more readable for me.
// I would only do this if I had to "pretty up" my code and didn't think it needed to change much.
float    x    = 0.0f;
ThingFoo foo  = ThingFoo::Null; 

In Topic: The Problem With Capitalism

23 September 2016 - 10:32 AM

So then who runs the TV station/produces the show? The government? That's a recipe for disaster.


Not necessarily. The people who work at the station could own the station collectively. Why jump immediately to "the government owns everything?"

But, I still "live like a poor person" in that I drive a car with 110,000 miles, have a $130,000 house, and spend as frugally as possible.


In my book, driving a car and owning a house is not living like a poor person. Driving a car and owning your own residence at all makes you lower-middle class, at worst.

My views may be somewhat skewed by the fact that I live in Vancouver - a place where the average single-family separated house costs over $1 million (one bedroom apartments can cost upwards of $100,000), rental vacancies are <1%, and the living wage is $20 an hour. For perspective, the minimum wage here is $10.70 an hour. I make a typical junior programmer salary and it will take me years to save up enough for just a down-payment on an apartment, never mind a house, and for now I'm paying ~$1000 a month in rent. That is considered ot be on the cheap end, and the fact that my rent hasn't gone up by at least a hundred a month in the two years I've lived in this place is frankly astounding. I know people years older than me who will never be able to afford a house on their own here. Comedians joke in comedy shows about being perpetual renters, and the response is typically a chorus of agreement. If you got into the housing market less than 20 years ago, and you own a house here, you are NOT living like a poor person no matter how frugally you live.

The usual response we get when we describe this to outsiders is, "why don't you move somewhere else?" To which I answer... where? This is where the jobs are in these parts. And it's only going to get worse, as folks from Alberta flood the place looking for jobs after the oil crash.
 
You want to see what unrestrained capitalism as applied to property looks like? I just described it. Not pretty, is it?
 

For the past few months I've been looking into houses to buy and rent out.


I would point out that by owning multiple houses and renting them out, you're taking away somebody else's opportunity to own the extra houses - and purely for your own profit. That doesn't seem fair - you're potentially shutting some people out of the market to milk them for their wealth. That being said, I'm not entirely opposed to this, if the circumstances are right for it - like in places where the rental supply is really low, like where I live. But still - mine is a city that is practically the face of unrestricted real-estate speculation and house flipping to the detriment of people who actually live and work here, so I get kind of grumpy when I see people casually talking about taking advantage of that kind of thing.

In Topic: The Problem With Capitalism

23 September 2016 - 08:49 AM

It's the "poor and needy" who will drive 500 meters to the gas station in the evening to buy beer for 4x the price, and it's their wealthy capitalist pig friends asking them "Huh, are you crazy? First, this is easily within walking distance, and second... that would be the world's most expensive beer, and it isn't even good beer" (yep, another anecdote from my life).

It's the same "poor any needy" who use public transports for free being 45-year old students awaiting hopefully soon retirement, who never cook at home but instead order meals, always have the newest phone and a ton of ringtones and apps, and who always moan they can't afford anything. Sure enough they can afford playing with gotcha guns, though. And every DVD of every new movie. Fuck, your kitchen is twice the size of my entire apartment, you captialist pig. How do you do this! That's unfair (... a verbatim quote that I've gotten once).


It's like you didn't read any of the links I posted earlier in the thread about what being poor is actually like.
 

It's a natural desire to own. Everybody wants to have something, no matter how small, and be able to say "this is mine, and mine alone".


Dying of pneumonia is "natural," too, yet now we can treat it. We are already subverting what's "natural" just by living in a high-technology society. Just because it's natural, does not mean that it is good - only that it is "easy."

If you really think "it's natural" is a valid excuse, then you can justify all kinds of things, and you'll have to change your lifestyle. You'll get all your food solely from hunting and gathering, wear only what you kill, and refuse all modern medicine in favour of herbs and religion. Full-on "Paleo" lifestyle. :P

In Topic: The Problem With Capitalism

22 September 2016 - 06:13 PM

I'm not personally opposed to inheritance as a concept. I'm also not actually a "Socialist" (with a capital-S). The real problem in my view is that some people have more opportunities than others through sheer luck of birth. That is a major part of what "class privilege" means, and also "racial privilege" and "gender privilege," and all other forms of privilege for that matter. Ideally, we should all have access to the same opportunities at the start - then our choices would really be the only thing standing in our way.

It's a common right-wing narrative that people become better-off or worse-off through their own choices. But as long as some people are given better access to education, food, and general living standards, one cannot truthfully say that any particular individual's success was due entirely to their own choices. There will always be subtle things working for or against us; an individual's success is less meaningful the higher up on the ladder they begin. A millionaire becoming a billionaire is an accomplishment, but it's not so much an accomplishment as a homeless person becoming a millionaire because of class privilege. The most meaningful successes are those who started the poorest of the poor and ended up the richest of the rich; but I can't think of more than a handful of examples of that.

In my view, we can only have a truly "fair" society - even a capitalist society - if everyone starts off from the same place. As long as there is imbalance of privilege, some of us are more "free" than others.

PARTNERS