Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it,
follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given
their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'
Posts
:rotate:
Yeh. Learning how to write plain C in an OO manner was one of the more interesting things I've learned at this school. It gave me new respect for having language support for classes, or even something like Go that isn't fully OO (no inheritance), but at least has interfaces and lets you assign functions to types (basically methods, so any type that has the right methods fits a given interface, and "interface{}" fits all types).
Java is just a very verbose way of expressing OO. C# cleans it up quite a lot but I feel sometimes it should have been a bit more daring with the syntax.
I love OO for code organization, but I totally understand the issue. I'm always fighting with myself on how much flexibility I need... do I need a parent class and then subclasses because feature X might happen in the future or do I keep it simple and just create this one class, etc.
Exactly. Sometimes you just have to take a step back and go WHOA WHOA WHOA!!! I will NEVER reuse this code, I'm going to make a Duck() class instead of an OxygenBreather->Animal->WingedAnimal implements LivesInWater-> Duck() class.
The most powerful aspect of OO is that if you're doing it right, you'll be able to adapt and implement things when you need them without having to throw up your hands and start over.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
I think that's why I like it. Its very easy to change direction midway through and still have very readable code. But doing it "right" and designing it with full OO in mind and such just makes me insane. Like my aforementioned OxygenBreather example.
YOU SHALL NOT DERIVE
So maybe you found a better way to sort your list, the person on the outside doesn't need to care. That's the largest benefit to OOD. There are more but that's the way I see it.
That is more about contract interface than OO, but for good reasons it is associated with class interfaces.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
Uh.. finder's fee and all.
Was a game/interface I made as part of a Phalla game on the boards here last year and I'm going to update it into something that will just stand on its own.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
Completely ignoring contract interface, it's also an example of encapsulation and separation of concerns, both huge pillars of OO. You can do what Bowen is describing without any sort of contractual interface, though providing one makes the design cleaner and easier to predict.
And unfortunately it isn't something you can teach. It is just experience.
So keep on keeping on~
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
There may be more formal lines drawn but to me contract interface means/includes "I am giving you this and expect this, sort it out however you like." So it means those other things too imo.
As I said, all common themes in OO, but not things that require OO.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
Premature polymorphism is a lot like premature optimization, in my experience.
I wrap them both under the header of over-engineering.
Does he know Java?
It was 4 years after I graduated before I heard of regex.
But I graduated ten years ago from a crappy school. (My assembly class was for some IBM-specific hardware that required us to use an emulator and photocopied book because it went out of print a decade before).
A good thing in my book.
Java is an example of when you under do it but don't provide any other way. The decision to not make functions first class objects is still inexplicable to this day.
Does he not know regular expressions or the function regex? Because it'd be odd to graduate without learning the former.
Maybe they didn't want to deal with closures? (Depending on what you consider first class object to mean)
The reason that academics (in particular certain PL folk) don't like OO is because it precisely leads to overly complex code whereas functional styles lead to more concise, elegant code.
There's a whole bunch of features mixed into the debate when it is phrased as "OO vs. functional" (like mutation, ADTs, polymorphism, etc.) so its not a cut-and-dry argument. However, after being in industry and academia now, I'm firmly in the functional side of things.
something@domain.com is really easy to check tokenwise. You do the same thing properly in regex and you're looking at, easily, a 256+ character regex that makes 0 sense outside of people that specialize in regex or have hours to dissect it.
Regex causes way more problems than it's worth. I'd probably admit to not knowing it too if someone asked me or if an interviewer questioned why I don't use it.
I wouldn't want to work for someone that uses regex anyways, shit be poopybutt-like.
And even if you are just taking some aspect of functional and using them in a basically OO system it is still a nice way to make things clear and clean. Or at least it feels that way, I'm far too new at coding to be good at design yet.
I'm on the "correct tool for the job" side of things. In most cases, that ends up being a mixture of OO and functional design patterns. They actually mix incredibly well if you know what you're doing.
The problem is too many people graduate from college and think they know what they are doing: They don't. It takes college + years of experience to actually know what you're doing, and the part that is optional is the college, not the years of experience. Not that college is bad, I recommend it for everyone. People just need to understand what a comp sci program is actually going to give you, and what it's not going to give you.
Normally I'd flip around your assumption though: you wouldn't care about using a hashmap unless you need to look something up via some identifier.
if you need an ordered hashmap, it looks like LinkedHashMap does what you want
If you need to define a view or slice of the group a list will be easier
If you can use a custom allocator for the list it can get great sequential iteration performance ( but just use a vector )
list can be used by multiple threads where one removes items and another adds items way easier than a hash map
I expect rehasing will be slow, so if you are dramatically changing the amount of items being stored a list would preform better.