• Advertisement

Nypyren

Member
  • Content count

    4824
  • Joined

  • Last visited

Community Reputation

12117 Excellent

2 Followers

About Nypyren

  • Rank
    Contributor

Personal Information

  • Interests
    Programming
  1. C# Basic C# quiz

    Ah, so it does. I'm thinking of a different case, I guess. There is at least one situation which looks similar to your example which compiles but discards the modification instead of producing a compile error. Can't remember exactly what it is now, though.
  2. C# Basic C# quiz

    Yeah, anyone you're hiring specifically for thorough C# knowledge should know all of those. However... 1. You want them to suggest changing it to IDisposable+using, right? It's not a very straightforward question but anyone with good C# experience should notice that. 2. Someone who knows to use generics at all probably will immediately understand the difference. And if they don't, the compiler will yell at them until they do. 3. You should remove the missing semicolon part of the question and focus on the return-struct-from-property nuance instead since that's far more important to understand. It WILL compile if you fix that semicolon, but it will silently discard the change they're trying to make. Asking "will it compile?" distracts from the real problem. 4. Avoiding (or intentionally using) lazy re-evaluation is important to understand. Keep it as-is. 5. The compiler will simply tell someone exactly what's wrong if they try that. When I worry about a programmer on my team making mistakes, I don't care about ones the compiler simply won't allow. Also, I've worked with a lot of very experienced developers who have just recently switched to C# who probably wouldn't understand ANY of those, but could be taught them in less than an hour. What you're testing for here is C# language knowledge only, not really general purpose programming skill. HOWEVER, it is likely that anyone who understands all of the nuances also has good general purpose skill. If someone passes this test with flying colors, they probably also have great general purpose knowledge. But if someone fails it, they might have tons of skill, but just switched from C++ recently or something. Suggestions for additional questions if you want an even more thorough C# skill check: operator+(string, string) vs. StringBuilder. It sounds trivial but make absolutely sure they know the difference. Functional programming (passing and returning first class functions). async/await.
  3. Serialization/Deserialization

    You could definitely control "inline" vs "use reference id" with attributes. If it makes the most sense, you could even have inline be the default. You could automatically switch to reference ids only if a cycle is detected. Things like that.
  4. Serialization/Deserialization

    I don't know if JSON.NET intrinsically can handle object->object references. I have implemented my own reflection-based serializer before and it handles arbitrary objects, including cyclic object references (what I assume you meant by recursion). The way it works is fairly simple: Do two passes. On the first pass, traverse all reference types and make a unique ID each time you run into a new one. Skip any you've already seen. On the second pass, actually serialize data: the number of reference types, followed by the Type of each reference type (so you can support polymorphism), and finally followed by the values for all of the fields in each object. When a field is a reference type, serialize the ID (reserve a number like 0 or -1 for null). When a field is a value type, serialize its entire contents directly. Deserialization then uses FormatterServices.GetUninitializedObject (or equivalent if you're not using .Net) to create all of the reference types first, then when fields are being deserialized, references to other objects can be assigned immediately. This supports polymorphism and arbitrary graphs of objects, which as far as I know is everything that can be represented in any data structure. The underlying data can be binary, JSON, XML, or whatever you want. You can optimize each of the individual pieces of data as much as you feel like: well-known type IDs instead of names, zigzag integer encoding and field IDs/sizes like protobuf has for versioning compatibility, etc.
  5. When did immediate mode take over the web?

    But how would that change how they make money (or are unable to make money, in many cases)? My 2018 prediction is that plain old news sites will begin adding cryptominers to their own pages to increase revenue.
  6. SAT not working properly

    What have you tried? Did you use a debugger to investigate what the values are which lead to the problem? It should be pretty easy to identify the issue if you have a repro case.
  7. Commands are functions, right? If they already perform work then why does anything need to be refactored? Perform the callback within the normal work of the command's function, or wrap the command with a command which calls the original command THEN the callback, if that makes more sense. Imagine this pattern, but adapted to whatever additional complexities you require (IPC, RPC, etc). Action WrapAction(Action command, Action callback) { return () => { command(); callback(); }; } If you're dealing with IPC then you will definitely need some way of handling responses and completion which can deal with the callback. It's not overkill. If you're NOT dealing with IPC then do you really need all those intermediate objects and queues?
  8. Multiperception Game Engine

    That's literally an empty document. Are you trolling or what? Are you a chatbot? Your name would make sense in that case.
  9. C++ Linker problem.

    Templates behave differently than the standard header/cpp file dichotomy. There are lots of references online; you should be able to find comprehensive info that explains why you need to have the implementation #included.
  10. Use callbacks/anonymous methods/lambdas/whatever C++'s modern equivalent is. C# example since it's easier to demonstrate: Popup("What to eat?", new string[]{"Cake", "Cookies!"}, x => { switch (x) { case 0: eatCake(); break; case 1: eatCookiesDammit(); break; } });
  11. Multiperception Game Engine

    You say you have done some of the planning already, but then you posted two meaningless pictures. Try posting things that have meaning first.
  12. Does u,v,w texture mapping exist?

    I stand corrected. It looks like the vector-to-sampler-address step is done for us. Using Hodgman's hints, I found this which seems relevant: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204881(v=vs.85).aspx
  13. Does u,v,w texture mapping exist?

    If you mean volume textures, then you need a W. https://msdn.microsoft.com/en-us/library/windows/desktop/bb206344(v=vs.85).aspx If you mean a cubemap, then no, the cube texture itself is flat and you only need U and V. https://en.wikipedia.org/wiki/Cube_mapping#/media/File:Skybox_example.png
  14. When did immediate mode take over the web?

    My experience with GUIs is that they have a whole lot of state which can be preserved between updates. If you resize your window, the layout needs to change. If you move your mouse over a button, there might be a mouse-over highlight. But if you're not constantly resizing the window, you don't need to redo the layout. If you're not constantly moving the mouse, you don't need to collision check every button or other clickable element. Keeping the UI state stored somewhere between updates so that it can be reused is called "retained mode". Usually there is no choice: Immediate mode is typically built on top of retained mode, and the code to actually render the GUI is inevitably draw calls. You can implement a pure immediate mode render-only GUI by just making draw calls, but if you discard layout and input state you end up having to redo all of your layout computations every time you want to render. The issues I've experienced with immediate mode is that the additional wrapper on top of retained mode is inefficient. If the immediate mode API doesn't include control identifiers, the wrapper layer has to spend time looking these up on each call. Retained mode GUIs have SEPARATE functions which update just what is actually needed at the moment (layout, mouse rect tests, keyboard input goes directly to whatever control has focus, etc). And those functions are only called when a change occurs. Immediate mode GUIs often jam literally everything into one function hierarchy representing the GUI hierarchy, and each individual control's function switches on what is happening (layout, input handling) and adjusts its internal retained mode state. The problem is that these APIs typically traverse the entire call hierarchy even if you don't need to, because they use the call order to determine which retained mode control ID is being referenced by the immediate mode function. If you skip calling a "Button" function in one case your entire GUI stops working. Particularly egregious examples of immediate mode GUI are Unity's OnGUI mehod, GUI and GUILayout classes. Unity basically calls your OnGUI method once per "event" (layout, paint, input handling, that kind of thing). Since much of the code in your OnGUI method may only be relevant to one or two of the event types, if you do anything other than GUI.* calls you're wasting time calculating things that will be discarded. Trying to do anything complicated with them can very quickly wreck performance. The hoops you can optionally jump through to increase performance (by avoiding irrelevant calculations in specific 'event' phases) are like writing a retained-mode interface wrapper on top of that. Unnecessary additional layers of abstraction when ideally you could just control the retained mode GUI under the hood. I haven't personally used any of the web-specific UI frameworks since I avoid web development like the plague, but my understanding is: The HTML elements are a 'retained mode' equivalent. The browser handles their layout and rendering. Why anyone would want to build immediate mode on top of that is beyond me.
  15. When did immediate mode take over the web?

    When have web developers *ever* made good decisions about technology choices? Someone decides they want something easy and minimal now, they make it available for the unwashed masses, and it spirals out of control for years. Wash, rinse, repeat.
  • Advertisement