[QUOTE=LennyPenny;52291717]Are you sure you are sane?[/QUOTE]
not in the slightest. for one thing, when i get off work my "fun" programming involves Vulkan or other masochistic low-level APIs
[editline]30th May 2017[/editline]
[QUOTE=nutcake;52292746]Never done C++ but aren't those !data->contains(ln) conditionals both dereferencing a nullpointer? Wouldn't that just segfault or throw an exception?[/QUOTE]
yeah, it should have. But somehow it never did. Which is [I]incredibly[/I] bizarre because nothing there is marked "noexcept" and its a very frequently called method.
[QUOTE=paindoc;52292750]
yeah, it should have. But somehow it never did. Which is [I]incredibly[/I] bizarre because nothing there is marked "noexcept" and its a very frequently called method.[/QUOTE]
I think Valgrind would show an invalid read error in this situation. Also maybe data is just rarely or never a nullpointer?
If data points to a type whose internal storage is at offset 0 it might just think it has an empty list of whatever it holds.
Also if the member function doesn't actually refer to itself ("this"), there's no access issue. If the method just returns 5 or whatever regardless of input and never actually reads from the null "this" pointer, it'll work fine.
[QUOTE=paindoc;52288134]-msvc stuff-[/QUOTE]
Here's a fun one we encountered: remove a file from the project but not the .filters file (version control accident), right click said file (MSVC crashes).
[editline]31st May 2017[/editline]
Oh and MSVC will infrequently start to produce invalid code until you restart the whole IDE. I have no fucking idea why, and I mean [i]really[/i] invalid, even across full rebuilds.
[editline]31st May 2017[/editline]
With 2017 they added an option which uses clang for parsing but MSVC codegen (C2), but it doesn't really work either. The LLVM bitcode -> C2 bit frequently explodes and their output / error log doesn't actually support the clang error syntax fully, so it won't always jump to files correctly. MSVC itself isn't even C++11 compliant.
It went from a bash script to a python flask server in just under a day
[vid]https://tenryuu.blob.core.windows.net/astrid/17-05-31_19-25-45.webm[/vid]
I'm pooped
[QUOTE=Tobba;52294980]Here's a fun one we encountered: remove a file from the project but not the .filters file (version control accident), right click said file (MSVC crashes).
[editline]31st May 2017[/editline]
Oh and MSVC will infrequently start to produce invalid code until you restart the whole IDE. I have no fucking idea why, and I mean [i]really[/i] invalid, even across full rebuilds.
[editline]31st May 2017[/editline]
With 2017 they added an option which uses clang for parsing but MSVC codegen (C2), but it doesn't really work either. The LLVM bitcode -> C2 bit frequently explodes and their output / error log doesn't actually support the clang error syntax fully, so it won't always jump to files correctly. MSVC itself isn't even C++11 compliant.[/QUOTE]
I will add it to the list of issues I pass to them whenever I meet with my aunt and see what she says about them. The files/filters is one I've kinda experienced myself.
I still find it so weird that I've never had any of these errors. My work project is a fairly large code base at this point, and is split into two projects grouped under one solution and I've really not had any issues with it.
I'm falling in love with Python at the moment. Have you guys seen "yield from"?
[code]
>>> def iternames(obj):
... if type(obj) is str:
... yield obj
... else:
... for child in obj:
... yield from iternames(child)
...
>>> for name in iternames(["a", "b", [["c", ["d", "e"]], "f"]]):
... print(name)
...
a
b
c
d
e
f
>>>
[/code]
It's great for iterating over properties of leaf nodes when you have a tree of objects. In my case it's for a toy HDL compiler, and I want to quickly iterate over all the signal names referenced by an expression so that I can build a rename table of global names when I instantiate a module.
Just found this and wanted to share :)
Am I the only one hating dependency injection?
It's so annoying to use and it just makes it much harder to read the code.
And then you have something like Zenject for Unity which makes the code even harder to read.
Some people swear by it, but I really don't think it's worth the hassle. It's one of the only 'good practice' things I really do not like.
[QUOTE=war_man333;52296320]Am I the only one hating dependency injection?
It's so annoying to use and it just makes it much harder to read the code.
And then you have something like Zenject for Unity which makes the code even harder to read.
Some people swear by it, but I really don't think it's worth the hassle. It's one of the only 'good practice' things I really do not like.[/QUOTE]
Dependency injection is so bad of a buzzword, the simplest form of what is defined as dependency injection is simply passing the dependencies of the thing when you create it, instead of for instance instantiating it in the constructor which creates the thing. (or passing it in explicitly by some other means, a setter or something)
The nonsense begins when people think you need to start using dependency injection [B]frameworks [/B]or similar nonsense for it.
[url]http://ideone.com/SMgxgd[/url]
^ the above example is literally "dependency injection", the interface thing isn't strictly required, it just makes the example slightly less dumb
[QUOTE=Profanwolf;52296399]Dependency injection is so bad of a buzzword, the simplest form of what is defined as dependency injection is simply passing the dependencies of the thing when you create it, instead of for instance instantiating it in the constructor which creates the thing. (or passing it in explicitly by some other means, a setter or something)
The nonsense begins when people think you need to start using dependency injection [B]frameworks [/B]or similar nonsense for it.
[url]http://ideone.com/SMgxgd[/url]
^ the above example is literally "dependency injection", the interface thing isn't strictly required, it just makes the example slightly less dumb[/QUOTE]
at least in my company it means that you magically bind some dependency to a class that needs it, and you cannot see from where the constructor is called, because the framework does it for you.
Also if it's so much nonsense, it seems weird that there's so many frameworks for it. I understand the need for a framework in Unity, because MonoBehaviours cannot have constructors. Personally I prefer just to have a function in there like
[code]
public class MyClass
{
public void Init(MyDependency myDependency)
{
this.dependency = myDependency;
}
}
[/code]
it does not force you to pass the dependency obviously.
I really like dependency injection and couldn't live without it.
I mainly used it in two case :
* Websites written in asp.net webforms.
* Client app written in angular 2.
It helps you to write cleaner code where the business logic is well seperated into services and without the need to have a singleton or static classes.
And with this, you can easily swap a service implementation if needed (at runtime too).
But IMHO it should be restricted to constructor injection. Other types of injections are more like "black magic" and make the code less readable.
Dependency injection or things like factories are what turn me off object orientation hard.
It'd take singletons and static classes over these all day
[editline]31st May 2017[/editline]
But I'm also mostly working on small single person projects without testing, so that might just be me
[QUOTE=LennyPenny;52297028]Dependency injection or things like factories are what turn me off object orientation hard.
It'd take singletons and static classes over these all day
[editline]31st May 2017[/editline]
But I'm also mostly working on small single person projects without testing, so that might just be me[/QUOTE]
Eversince I've started working in a real software company, all the enterprisey shit started making sense. In such a big development environment it is actually faster to use all that PITA crap.
[QUOTE=LennyPenny;52297028]Dependency injection or things like factories are what turn me off object orientation hard.
It'd take singletons and static classes over these all day
[editline]31st May 2017[/editline]
But I'm also mostly working on small single person projects without testing, so that might just be me[/QUOTE]
Testing is kind of a pain but kinda great once you have it setup. I'm really glad I put the time into getting it working for my work stuff, and it's also been useful for my Vulkan stuff (mainly testing to ensure resource creation and destruction proceeds properly).
[QUOTE=DrDevil;52297162]Eversince I've started working in a real software company, all the enterprisey shit started making sense. In such a big development environment it is actually faster to use all that PITA crap.[/QUOTE]
I've found a lot of use in things like the factory pattern, especially when it came to trying to make some of my work/personal projects more robust. I used to it to make things like platform-specific window instantiation suck (slightly) less. I used it at work to generate different kinds of infill generators using only one interface, too, and my past solution was a lot uglier than that. And it made multithreading shitloads easier, since calling a factory method was a lot easier than trying to get asynchronous constructors to play nice.
Salesforce released an API preview for Summer 2017. My boss told me and my teammates to make sure the old API calls that our application uses still work. I told my teammates to go through our code and test every feature that makes an API call to make sure it still works.
I just typed sforce.opencti in chrome's developer console and looked at all the fields. I got my work done in 15 minutes and did nothing the rest of the day :v:
[QUOTE=DrDevil;52297162]Eversince I've started working in a real software company, all the enterprisey shit started making sense. In such a big development environment it is actually faster to use all that PITA crap.[/QUOTE]
I can see how it's necessary with languages and/or environments that don't have good tooling support or reflection (Java), but I'm pretty sure that in most other cases it would be more efficient to develop components normally and let some automated process redirect calls as necessary at that point.
[QUOTE=LennyPenny;52297028]Dependency injection or things like factories are what turn me off object orientation hard.
It'd take singletons and static classes over these all day
[editline]31st May 2017[/editline]
But I'm also mostly working on small single person projects without testing, so that might just be me[/QUOTE]
Unless I'm wrong I dont think dependency injection is an OO patterns.Still it makes sense once you start working on big projects that have multiple views (websites).
Say you are making a website and need users admin page. You'll surely need a reference to the database. One way to get it is to make a singleton, and use it with a static reference. Or you could just put in the view constructor a reference to the database and let the dependency injection handle this. It'll ensure to return a unique instance if needed, maybe a new one per query. If you need any other services, just ask for it into the constrictor and you'll have it. No needs to write a singleton class each time.
Dependency injection is a crazy useful technique, just 99% of DI uses don't need a framework.
[QUOTE=proboardslol;52297634]Salesforce released an API preview for Summer 2017. My boss told me and my teammates to make sure the old API calls that our application uses still work. I told my teammates to go through our code and test every feature that makes an API call to make sure it still works.
I just typed sforce.opencti in chrome's developer console and looked at all the fields. I got my work done in 15 minutes and did nothing the rest of the day :v:[/QUOTE]
You must have quite an easy going position, if you can do one task, and then be off for the day.
I first learned about dependency injection when a friend of mine who works at a Java shop told me how great that framework was they had. I didn't and do not to this day understand why the hell passing shit a type needs into the constructor needs a fancy name like that, and frameworks around it - it seems pretty obvious to me that when your class needs an instance of some other class, you pass it in the constructor or via some setter or whatever. I mean we don't go and call using copy constructors "value injection" or shit like that.
[QUOTE=DrDevil;52297162]Eversince I've started working in a real software company, all the enterprisey shit started making sense. In such a big development environment it is actually faster to use all that PITA crap.[/QUOTE]
I've been working in a real software company for 3 months and I've pretty much never used any of the bullshit buzzwords I learnt at university. Payroll is spaghetti because it was outsourced though. Fuck outsourcing.
We use agile and sprints and that's about it.
[QUOTE=JWki;52298725]I first learned about dependency injection when a friend of mine who works at a Java shop told me how great that framework was they had. I didn't and do not to this day understand why the hell passing shit a type needs into the constructor needs a fancy name like that, and frameworks around it - it seems pretty obvious to me that when your class needs an instance of some other class, you pass it in the constructor or via some setter or whatever. I mean we don't go and call using copy constructors "value injection" or shit like that.[/QUOTE]
The only place I've seen dependency injection is in this talk
[video=youtube_share;E8I19uA-wGY]http://youtu.be/E8I19uA-wGY?t=1817[/video]
He uses partial function application to capture the dependencies in a closure and return the non-depending type. FP is really beautiful, I want to learn more about it.
Not sure why you would need/want a framework for this? :v:
[QUOTE=Radical_ed;52257202]one down, one to go
[IMG]https://my.mixtape.moe/gijbwx.gif[/img][/QUOTE]
Decided to re-do most of the raw calculations in c++ for speed- working excellently so far
[img]https://my.mixtape.moe/avfkvk.gif[/img]
[QUOTE=Radical_ed;52299588]Decided to re-do most of the raw calculations in c++ for speed- working excellently so far
[img]https://my.mixtape.moe/avfkvk.gif[/img][/QUOTE]
this is incredibly fascinating and also kinda eerie. Still super cool, though!
Somehow I recorded multiple 20gb performance reports in VS yesterday. I only noticed because I opened up WinDirStat and saw several large chunks with the ".vsp" extension, but uhhhh what?
[QUOTE=JWki;52298725]I first learned about dependency injection when a friend of mine who works at a Java shop told me how great that framework was they had. I didn't and do not to this day understand why the hell passing shit a type needs into the constructor needs a fancy name like that, and frameworks around it - it seems pretty obvious to me that when your class needs an instance of some other class, you pass it in the constructor or via some setter or whatever. I mean we don't go and call using copy constructors "value injection" or shit like that.[/QUOTE]
The idea of using a framework for that is that you have everything centralized, and the DI handles constructing the objects and passing appropriate object instances for you. All your code needs to do is say "I want an instance of this interface", and if the DI is set up properly, you'll get it.
This is extremely useful for when you need to change implementations of something later on, because since your actual logic code only works with interfaces instead of concrete implementations, it doesn't matter what the "services" being injected are actually doing.
For example, if you had an interface for a basic key/value store (say, for configuration), the classes that use the config would just ask for an IConfig with some properties - the implementation of which can be switched out very easily later between local file json, some redis server, a relational database, environment variables, whatever.
It's also valuable for unit testing where you can set up mock versions of a service that holds dummy data, doesn't actually call out to a database or filesystem, etc. without actually changing the classes you're testing.
[QUOTE=Radical_ed;52299588]Decided to re-do most of the raw calculations in c++ for speed- working excellently so far
[img]https://my.mixtape.moe/avfkvk.gif[/img][/QUOTE]
What exactly am I seeing here?
[QUOTE=Dr Magnusson;52294148]Also if the member function doesn't actually refer to itself ("this"), there's no access issue. If the method just returns 5 or whatever regardless of input and never actually reads from the null "this" pointer, it'll work fine.[/QUOTE]
True, but if the member function is marked as [i]virtual[/i], it'll need to dereference the "this" pointer to figure out where the virtual table is (and thus allow us to call the virtual function).
[QUOTE=DrDevil;52301397]What exactly am I seeing here?[/QUOTE]
50,000 poles trying to point the same way their neighbors are pointing
how do you guys feel about kotlin in general?
Sorry, you need to Log In to post a reply to this thread.