• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Anyone want to make a project with me? Or does anyone have some type of free remote work? I just want experience and more chances to improve. I want to be apart of something.
 

Megasoum

Banned
So I'm taking Programming 1 in University and today's course was about variable type and my teacher is pronouncing "char" as "Schar" instead of "kar" and this is freaking me out...

Have I been wrong (in my head) for the last 15 years or it is really weird to say it like that?
 
So I'm taking Programming 1 in University and today's course was about variable type and my teacher is pronouncing "char" as "Schar" instead of "kar" and this is freaking me out...

Have I been wrong (in my head) for the last 15 years or it is really weird to say it like that?

Uhh, both are wrong? It's char, just like it looks. ch, phonics. cha-ching!

WTF is "schar"? How do you even say that with a straight face?
 
So I'm taking Programming 1 in University and today's course was about variable type and my teacher is pronouncing "char" as "Schar" instead of "kar" and this is freaking me out...

Have I been wrong (in my head) for the last 15 years or it is really weird to say it like that?

I think it’s pronounced char like Charizard.
 

Somnid

Member
I accept "char" (how it looks) and "care" (how it would sound if you cut the rest of "character") though generally the former. Special cases: char* (always "char star") and varchar (always "var car") because the alliteration is pleasing.
 
Lol

I've always only heard of it as car.

Add a typedef for it in your heads if it doesn't sound correct!

Careful, you might need to take the 'car' of a list, that won't work if car is also a typedef.

Plus the fact that car already means "first item in a list" is a good reason not to overload the pronunciation
 

vypek

Member
I accept "char" (how it looks) and "care" (how it would sound if you cut the rest of "character") though generally the former. Special cases: char* (always "char star") and varchar (always "var car") because the alliteration is pleasing.

This is pretty much how I feel about it.
 

balgajo

Member
Do you guys use TDD? I work with C++ and Qt on embedded devices and our team never used TDD. We have two Q&A guys that are doing fine, even though our application is getting too big. I feel bad for not using it...
 

Koren

Member
Uhh, both are wrong?
I don't think there's really a "right" here...

I guess I was wrong... I always thought of it as the abbreviation of Character.
It is...

What? Isn't char short for character, and should therefore be pronounced as such?
That would be my pick.

I'm used to "kar", as the beginning of both the english character and the french caractère. But i've heared "shar" a lot (there's a french word char that pronounces like that, the old antique vehicule behind horses, and I'm pretty sure the word "car" in english come from that) and "tchar" from time to time. To each his own, I guess.
 
Sidestepping the whole "char" debate for a moment (I use both "char" (as in Charizard) and "c(h)ar" as in "character" interchangeably).

I'm doing a semester of C this year in college and looking for a decent book, it doesn't have to be a weighty tome with thousands of pages going into the depths of C.

Just something reasonably straight forward (but not a beginner book). Wouldn't mind something that has a bit of depth when it comes to threads, trees and pointers.

Any suggestions?
 
Careful, you might need to take the 'car' of a list, that won't work if car is also a typedef.

Plus the fact that car already means "first item in a list" is a good reason not to overload the pronunciation

This sailed right over my head. I've never knew there was a term for first item in a list!
 
Test Driven Development.

Basically its:
Code:
The QA writes a test and runs it > It fails.
The Dev writes just enough code to cause the test to pass. 
Repeat

It's an attempt to shift the testing process left.
 
Test Driven Development.

Basically its:
Code:
The QA writes a test and runs it > It fails.
The Dev writes just enough code to cause the test to pass. 
Repeat

It's an attempt to shift the testing process left.

Not a fan of TDD personally, or anything else that starts from the assumption that a non technical manager or executive knows how to write better software than i do.

That doesn't mean I think it's never true. In some cases management has a different definition of "better" than the engineers, or cannot trust the engineers to deliver on their definition of better. In those cases TDD might make sense, but I would just not work for such a place.
 

Somnid

Member
Not a fan of TDD personally, or anything else that starts from the assumption that a non technical manager or executive knows how to write better software than i do.

That doesn't mean I think it's never true. In some cases management has a different definition of "better" than the engineers, or cannot trust the engineers to deliver on their definition of better. In those cases TDD might make sense, but I would just not work for such a place.

That's a misunderstanding of TDD. While you can elevate it to a whole project management thing, it would be done so that that there is no mismatched expectations. That is, you would work with the QA/Test Engineer to design a test that encompasses the feature before you sit down to write it. This way it's "done" when the test passes. After all, you can write the world's most beautiful code but if it doesn't solve the business problem it's worthless.

TDD is also applied on a more micro level. I may write a bunch of unit tests and then write my code. The idea is that you have constant verification and aren't just solving the one case in isolation. Also, testable code is almost always better code because it's typically doing less, saving less state and has a more defined functionality and that's just a natural byproduct.

Of course sometimes you don't have enough requirements or you don't have a best approach. It can be harder to do TDD in these cases because you might wind up doing lots of rewrites and refactoring and the tests are just needless overhead. You should always take a look at how much value it adds. Most project's I've worked on are hybrids of some sort.
 

Lister

Banned
Not a fan of TDD personally, or anything else that starts from the assumption that a non technical manager or executive knows how to write better software than i do.

That doesn't mean I think it's never true. In some cases management has a different definition of "better" than the engineers, or cannot trust the engineers to deliver on their definition of better. In those cases TDD might make sense, but I would just not work for such a place.

Huh? I've never heard of TDDD described as QA writing the test... how woud that work? The developer writes just enough test to fail, then writes enough code to pass, then nrepeats the process.
 

Pokemaniac

Member
Do you guys use TDD? I work with C++ and Qt on embedded devices and our team never used TDD. We have two Q&A guys that are doing fine, even though our application is getting too big. I feel bad for not using it...

I find pure TDD to be generally impractical, particularly if you have to deal with a GUI of any sort.

High code coverage should generally be strived for, though.
 
Huh? I've never heard of TDDD described as QA writing the test... how woud that work? The developer writes just enough test to fail, then writes enough code to pass, then nrepeats the process.

Same for me too, this is how I've always understood it/heard it described.

The notion that QA writes the test and not the dev seems crazy to me.
 
Huh? I've never heard of TDDD described as QA writing the test... how woud that work? The developer writes just enough test to fail, then writes enough code to pass, then nrepeats the process.

FWIW I wasn't implying that either, I think another person said that.

I do think there's some good *ideas* in TDD, but as mentioned, I don't like anything that tries to lay down formal rigid processes for how things should be done, because the world isn't that black and white.

For example, I do think you should always have specific tests *in mind* when you write new code. Because otherwise you will produce code that isn't testable. But the notion that I should write a test against an API that doesn't even exist yet, or that I should go out of my way to write as little code as possible to get the test to pass is silly to me.
 

Koren

Member
Do you guys use TDD?
Strictly talking no.

But I often develop by setting a small additional feature, program it, and repeat.


Though I think the "just enough code" is a bad way to consider it. I mean...

Let's imagine a function "Square"

s(2) = 4
Code:
int s(x) {
    return 4;
}

s(-1) = 1
Code:
int s(x) {
    return 4+(x-2);
}

s(3) = 9
Code:
int s(x) {
    if (x==3) {
        return 9;
    } else {
        return 4+(x-2);
    }
}

etc.

That's caricatural, of course, but when you develop (especially data structure), forward thinking is useful (not too much, you don't want to have a giant class when you won't need it for ages, but still)
 

Antagon

Member
Strictly talking no.

But I often develop by setting a small additional feature, program it, and repeat.


Though I think the "just enough code" is a bad way to consider it. I mean...

Let's imagine a function "Square"

s(2) = 4
Code:
int s(x) {
    return 4;
}

s(-1) = 1
Code:
int s(x) {
    return 4+(x-2);
}

s(3) = 9
Code:
int s(x) {
    if (x==3) {
        return 9;
    } else {
        return 4+(x-2);
    }
}

etc.

That's caricatural, of course, but when you develop (especially data structure), forward thinking is useful (not too much, you don't want to have a giant class when you won't need it for ages, but still)

The problem here is not even that you write 'just enough code', but that you start with the wrong test. aze.. For a square merhod, my first test case would be something like this:

Code:
"s returns the square of x"() {
expect:
s(x) == expected
where:
x   | expected
0   | 0
1   | 1
2   | 4
5     |   25
365 |   13325
46340 | 2147395600
-1    | 1
-40 | 1600
}

The second test would be something like this:

Code:
"s throws an OutOfRangeException when the square of x does not fit in an integer"() {
when:
s(x)
then:
thrown(OutOfRangeException)
where:
x << [46341, -46341, Integer.MAX_VALUE]
}
Now, I don't exactly use TDD religiously, but I have found that it does force me to think better about edge cases, error handling, etc.

Also, refactoring is the third step in the normal TDD proces. And then there's the London or mockist school which takes the whole proces five steps further and adds in defining the boundaries for your 'unit of work' so you can mock them before writing tests. Haven't tried that approach yet, but seems an interesting way to put a lot of focus on the D part of SOLID. But then, it's also way overboard unless you're working on giant enterprise systems.
 

Mike M

Nick N
Man, I am on like the last hurdle of my project, but it's proving to better than me.

Anyone good with Swift 3 and Core Data? Because I'm having the following problem:

I have a booking object:

Code:
class Booking {
    let departureFlight : Flight
    let returnFlight : Flight
    init(departure: Flight, returning: Flight) {
        self.departureFlight = departure
        self.returnFlight = returning
    }
}

in my .xcdatamodeld, I have the following attributes:

Code:
departureFlight
returnFlight

My first problem: I don't know what to set the Type for these as. I've tried Data and Transformable, and I've also tried doing each property of both the returning and departure flights as their individual data types, but that didn't work either.

Here's the implementation:

Code:
var departureFlight : Flight!
var returnFlight : Flight!

func save() {
        guard let delegate = UIApplication.shared.delegate as? AppDelegate else {
            return
        }
        
        let managedContext = delegate.persistentContainer.viewContext
        let entity = NSEntityDescription.entity(forEntityName: "Bookings", in: managedContext)!
        let newBooking = NSManagedObject(entity: entity, insertInto: managedContext)
        
        newBooking.setValue(departureFlight, forKeyPath: "departureFlight")
        newBooking.setValue(returnFlight, forKeyPath: "returnFlight")
        
        do {
            try managedContext.save()
        } catch let error as NSError {
            print("Could not save. \(error.description)")
        }
    }

It's not even getting to the catch statement to throw an error, it crashes with this:

Code:
[error] error:  Failed to load model named Core_Data
CoreData: error:  Failed to load model named Core_Data
2017-09-21 12:34:55.818 SunSeeker[63982:3738274] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'Bookings''
*** First throw call stack:

I'm at my wit's end, I need to have this done by tonight.
 

Koren

Member
The problem here is not even that you write 'just enough code', but that you start with the wrong test. aze.. For a square merhod, my first test case would be something like this:
In this case, I agree, but I was trying to find a simple way to convey the idea that it may be like running in the fog... By being short-sighted, you may have to redo a lot of things.

If large cities subways had been designed by taking a list of "I must go there" places and reach one place at a time by modifying the lines, you would have ended up with a really strange network..

Now, I don't exactly use TDD religiously, but I have found that it does force me to think better about edge cases, error handling, etc.
I'm all for development based on tests, in a lot of cases. I just don't think doing *just* the amount of code to pass the test #i is the best possible thing you can do.

Also, refactoring is the third step in the normal TDD proces.
Indeed, but you may spend much, much more time in refactoring that you would have spend to design the whole project with more insight at the beginning.
 
I'm all for development based on tests, in a lot of cases. I just don't think doing *just* the amount of code to pass the test #i is the best possible thing you can do.

Exactly, this is what I hate about it. Like, I agree it works well if you have a team full of peopel that can't be trusted to make the right judgement calls about what the right amount of work is. But usually you've got at least 1 or 2 senior people who can do code reviews and guide them into reducing complexity.
 
Hi. I've been taking computer science classes at my community college for a bit over a year. I took an intro to programming class (using Python) in the Spring and just started taking an intro to C++ class. However, I wanted to ask something a little more off topic but didn't know where else to post. I've been taking college classes for years (have my general AA degree) not knowing what I want to do but now I feel like I know what I should work towards. There's a big Microsoft data center about 40 miles from my house and a System Administration degree is a good way to get into it. My current class is one of the last general classes I need towards it before getting into much more specific ones. I was wondering if anyone was working as one and what I should expect from it.
 
Test Driven Development.

Basically its:
Code:
The QA writes a test and runs it > It fails.
The Dev writes just enough code to cause the test to pass. 
Repeat

It's an attempt to shift the testing process left.

In my office, someone writes a test, months later someone else is trying to get their code to work but the test fails, the second person comments out the first person's tests. Eventually our tests end up being one test that is impossible to fail.
 
This is probably a long shot, but I'm trying to write a tool in C# that extracts patterns from the Photoshop pattern file format. I got the Bubbles pattern out fairly easily. But now I'm stuck on Tie Dye. How am I supposed to work with all these various unknown pixel formats? All I know is it's supposed to be RGB, but the output is all wrong.
 

Sesuadra

Unconfirmed Member
Congratulations. Sounds exciting. Syntax books are kind of a waste, IMO. Everything syntax related is one search away. I would use books to pick up design patterns, methods of refactoring, and things like that.

For Java stuff, codingbat and hacker rank are great resources for problem solving. I used Udemy and YouTube to learn syntax. Tbh, general SQL is easy and can be reviewed in a couple of days, if not shorter. I am not sure how much you'll need to learn, tho.

Just ask questions. Literally no stupid ones. Sometimes it's just hard to explain things so there's a language barrier - not necessarily traditional.

I am learning with you - I am aspiring to be a good Java developer and a useful developer overall so we can leverage each other.

Have fun.
it really is crazy. yesterday I looked into ruby with lrthw and into java.. "hello world" in both done.

but I've to say I'm super nervous. 3 weeks left until class starts. 9 months school and then 15 months internship in a company I've to find myself.

and thanks :D!
 

Koren

Member
Syntax books are kind of a waste, IMO. Everything syntax related is one search away.
Well, yes and no... If you're looking for a given syntax, yes, you'll find it online.

But ressources about syntax can suggest you syntaxes you would never have thought existed, thus never look for. You often find those in advanced books too, though. But I still find interesting sometimes to look at ressources specifically on syntax. Hell, I sometimes directly read the raw grammar of a language...

Also, a good ressource on syntax can present you everything in a clear, systematic manner, which can be useful sometimes.

That being said, I talk about ressources, not necessarily books (though I like to have some reference in my e-reader, so websites I can't download aren't always the most useful thing).
 
it really is crazy. yesterday I looked into ruby with lrthw and into java.. "hello world" in both done.

but I've to say I'm super nervous. 3 weeks left until class starts. 9 months school and then 15 months internship in a company I've to find myself.

and thanks :D!

If you want to start a project together, let me know.

I really want to a collaborative project with people. Like, work for free, all that.
 
Do you happen to have links? I heard of this but never knew how to really get started.

Hmm, just google for popular open source projects? LLVM, Git, Swift, Python, Subversion, Chromium are all open source projects.

Probably helps to start by picking a language / technology stack you want to learn, as well as a domain you’re interested in (compilers, video, etc)
 
Does anyone have familiarity with software testing certification, like ISTQB?

Is this something taken seriously by employers and is it worth pursuing?
 

ricki42

Member
Do you happen to have links? I heard of this but never knew how to really get started.

If you're interested in game development, there are also a lot of open-source projects looking for contributors. For example 0 AD. Their engine is c++, the scripting JavaScript. I just skimmed their website, and they have a list of beginner tickets.
There are a lot of other opensource game projects, this is just the first that came to mind because it's fairly big. SuperTuxKart is another, also has a - rather short - list of beginner tasks.
 
Anybody here have experience programming Discord bots?

I don't have much programming knowledge (yet!), but I think a (relatively simple) Discord bot is a small enough project that I think I could accomplish in a reasonable amount of time.

Mainly my project goal would be to do a bot (or several) that relate to EVE Online, enabling functions such as posting killboard data, or synchronizing server roles with in-game character permissions (corp/guild management), and/or posting official update news/patch notes, to name a few examples.

If you can, tell me what sort of things I'd need to know, and potentially crush (or enable!) my dreams on this.
 
Top Bottom