Search Results

Search found 504 results on 21 pages for 'abstraction'.

Page 8/21 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Class Versus Struct

    - by Prometheus87
    In C++ and other influenced languages there is a construct called Structure (struct) and we all know the class. Both are capable of holding functions and variables. some differences are 1. Class is given memory in heap and struct is given memory in stack 2. in class variable are private by default and in struct thy are public My question is that struct was somehow abandoned for Class. Why? other that abstraction, a struct can do all the same stuff a class does. Then why abandon it?

    Read the article

  • Strategies for porting application from Win32 API to GTK+

    - by Vitor Braga
    I have a legacy application written in C, using the raw Win32 API. The general level of abstraction is low and raw dependency on <windows.h> is common. I would like to port this application to GTK+. There are any kind of guidelines or best practices on how to do this? I've previously ported a MFC application to Qt, but the application was very abstracted - it draw it's own set of widgets, for example - and initial porting was very straightforward. I've been thinking at first using Wine to build a native Linux executable and then trying to slowly refactor it into a GTK+ app. Does some one have best practices or previous experiences to share about this?

    Read the article

  • unit testing on ARM

    - by NomadAlien
    We are developing application level code that runs on an ARM processor. The BSP (low level code) is being delivered by a 3d party so our code sits just on top of this abstraction layer (code is written in c++). To do unit testing, I assume we will have to mock/stub out the BSP library(essentially abstracting out the HW), but what I'm not sure of is if I write/run the unit test on my pc, do I compile it with for example GCC? Normally we use Realview compiler to compile our code for the ARM. Can I assume that if I compile and run the code with x86 compiler and the unit tests pass that it will also pass when compiled with RealView compiler? I'm not sure how much difference the compiler makes and if you can trust that if the x86 compiled code pass the unit tests that you can also be confident that the Realview compiled code is ok.

    Read the article

  • Clarify the Single Responsibility Principle.

    - by dsimcha
    The Single Responsibility Principle states that a class should do one and only one thing. Some cases are pretty clear cut. Others, though, are difficult because what looks like "one thing" when viewed at a given level of abstraction may be multiple things when viewed at a lower level. I also fear that if the Single Responsibility Principle is honored at the lower levels, excessively decoupled, verbose ravioli code, where more lines are spent creating tiny classes for everything and plumbing information around than actually solving the problem at hand, can result. How would you describe what "one thing" means? What are some concrete signs that a class really does more than "one thing"?

    Read the article

  • What is the correct pattern to use in this case?

    - by nulliusinverba
    I'm sure this scenario has arisen before, and I want to know what experience has taught to be the best solution. I have a number of classes that are all of a kind. Say all the objects are "Content". They may be "Article", or "Book" for example. The reason I want the "Content" abstraction is because I want to define a number of behaviours for all "Content" objects and not have to build a new DB Table and 10 classes of essentially the same code for each type of "Content". For example, to attach a "Tag" or a "Premise" to a content object would be much nicer if, say, I just had two columns one for ContentID and one for TagID. A solution I've played around with is to have a Content table with a unique ID, and then to have foreign key references on all the other tables (Book, Article, etc). This has actually proven quite solid, but I'm just not sure about it. Do you know how to call this described pattern?

    Read the article

  • Does functional programming mandate new naming conventions?

    - by Jakob
    I recently started studying functional programming using Haskell and came upon this article on the official Haskell wiki: How to read Haskell. The article claims that short variable names such as x, xs, and f are fitting for Haskell code, because of conciseness and abstraction. In essence, it claims that functional programming is such a distinct paradigm that the naming conventions from other paradigms don't apply. What are your thoughts on this?

    Read the article

  • Casting of interfaces

    - by Srinivas Reddy Thatiparthy
    interfaces provide a useful abstraction capability. One can have a class Foo implement some interfaces, say A, B, and C. Some client code may get a reference of type A, others one of type B, etc. each actually the same Foo object but the interface exposing only a narrow subset of the functionality. Of course, evil client code can try to cast the A reference to Foo, then access the other functionality.How to prevent this?

    Read the article

  • Why does System.Windows.MessageBoxImage have enumeration sub-items with the same value?

    - by devdigital
    Hi, I'm trying to write my own abstraction over the MessageBoxImage enumeration, and see that MessageBoxImage is defined as: namespace System.Windows { public enum MessageBoxImage { None = 0, Error = 16, Hand = 16, Stop = 16, Question = 32, Exclamation = 48, Warning = 48, Asterisk = 64, Information = 64, } } How does the Show method determine whether to display an Error image or a Hand image? How would I write a method which takes a MessageBoxImage type, and return a CustomMessageBoxImage type which maps to the MessageBoxImage type, as I can't include both MessageBoxImage.Error and MessageBoxImage.Hand in the same switch statement?

    Read the article

  • Database-independant SQL String Concatenation in Rails

    - by Craig Walker
    I want to do a database-side string concatenation in a Rails query, and do it in database-independent way. SQL-92 specifies double-bar (||) as the concatenation operator. Unfortunately it looks like MS SQL Server doesn't support it; it uses + instead. I'm guessing that Rails' SQL grammar abstraction has solved the db-specific operator problem already. If it does exist, how do I use it?

    Read the article

  • Good PHP ORM Library?

    - by sgibbons
    Does anyone know of a good object-relational-mapping library for PHP? I know of PDO/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the domain model and the relational model. I'm looking for a PHP library that functions similarly to the way Hibernate does for Java/.Net.

    Read the article

  • Cocoa - Timer object that can be started, suspended, resumed?

    - by psychotik
    I'm looking for a repeating timer object that allows me to create it once and then suspend and resume it as needed for the lifetime of my application. I've seen documentation for NSTimer and although I think I can make it do what I want by building an abstraction on top of it that creates/invalidates timer objects multiple times, I was curios if there is a better way using some other system timer implementation. I'm not too familiar with Mac development and couldn't find any other leads besides NSTimer.

    Read the article

  • What is a .NET app domain?

    - by Luke
    In particular, what are the implications of running code in two different app domains? How is data normally passed across the app domain boundary? Is it the same as passing data across the process boundary? I'm curious to know more about this abstraction and what it is useful for. EDIT: Good existing coverage of AppDomains in general at http://stackoverflow.com/questions/622516/i-dont-understand-appdomains

    Read the article

  • java library for unit conversions

    - by Samuel
    Are there any java libraries (Apache Style licenses) which provide a higher level of abstraction for unit conversions. e.g. kilograms to grams or grams to kilograms meters to centimeters or centimeters to meters ft - inches to centimeters I have looked at JSR 275 but it seems to be in a rejected state. Any Apache 2.0 style license will definitely help me here.

    Read the article

  • HMVC/PAC - how to handle shared abstractions/models?

    - by fig-gnuton
    In HMVC/PAC, what's the recommended way to code if two or more triads/agents share a common model/abstraction? Do you instantiate a new instance of that model wherever needed, and propogate a change in one to all the other instances via the controllers? Or do instantiate one model at some common upper level, and inject that instance wherever needed? (Or neither if I'm missing something fundamental about these patterns?)

    Read the article

  • Is there a way to avoid debugger?

    - by Gabriel Šcerbák
    I don't like debugging in a debugger, because I think it is often below the abstraction layer of the programming language and it is often not reproducible. I favor usign unit tests when possible and I think they are a good way, but it is not always that easy to implement them. Do you know about any other alternative approaches to avoid the use of debugger?

    Read the article

  • Finding patterns in source code

    - by trex279
    If I wanted to learn about pattern recognition in general what would be a good place to start (recommend a book)? Also, does anybody have any experience/knowledge on how to go about applying these algorithms to find abstraction patterns in programs? (repeated code, chunks of code that do the same thing, but in slightly different ways, etc.) Thanks Edit: I don't mind mathematically intensive books. In fact, that would be a good thing.

    Read the article

  • How do I recover from an unchecked exception?

    - by erickson
    Unchecked exceptions are alright if you want to handle every failure the same way, for example by logging it and skipping to the next request, displaying a message to the user and handling the next event, etc. If this is my use case, all I have to do is catch some general exception type at a high level in my system, and handle everything the same way. But I want to recover from specific problems, and I'm not sure the best way to approach it with unchecked exceptions. Here is a concrete example. Suppose I have a web application, built using Struts2 and Hibernate. If an exception bubbles up to my "action", I log it, and display a pretty apology to the user. But one of the functions of my web application is creating new user accounts, that require a unique user name. If a user picks a name that already exists, Hibernate throws an org.hibernate.exception.ConstraintViolationException (an unchecked exception) down in the guts of my system. I'd really like to recover from this particular problem by asking the user to choose another user name, rather than giving them the same "we logged your problem but for now you're hosed" message. Here are a few points to consider: There a lot of people creating accounts simultaneously. I don't want to lock the whole user table between a "SELECT" to see if the name exists and an "INSERT" if it doesn't. In the case of relational databases, there might be some tricks to work around this, but what I'm really interested in is the general case where pre-checking for an exception won't work because of a fundamental race condition. Same thing could apply to looking for a file on the file system, etc. Given my CTO's propensity for drive-by management induced by reading technology columns in "Inc.", I need a layer of indirection around the persistence mechanism so that I can throw out Hibernate and use Kodo, or whatever, without changing anything except the lowest layer of persistence code. As a matter of fact, there are several such layers of abstraction in my system. How can I prevent them from leaking in spite of unchecked exceptions? One of the declaimed weaknesses of checked exceptions is having to "handle" them in every call on the stack—either by declaring that a calling method throws them, or by catching them and handling them. Handling them often means wrapping them in another checked exception of a type appropriate to the level of abstraction. So, for example, in checked-exception land, a file-system–based implementation of my UserRegistry might catch IOException, while a database implementation would catch SQLException, but both would throw a UserNotFoundException that hides the underlying implementation. How do I take advantage of unchecked exceptions, sparing myself of the burden of this wrapping at each layer, without leaking implementation details?

    Read the article

  • How to replicate CoreData NSFetchedResultController with plain SQLite?

    - by jchatard
    I would like to replicate the notification sort of system provided with CoreData NSFetchedResultController which with really little enables us to update a tableView based on events such as Insert/Update/Delete of objects represented as Cells. I'm currently using SQLitePersistentObjects as a Database abstraction layer: http://code.google.com/p/sqlitepersistentobjects/ If you have any idea or something working or at least advices I'd be very happy! Thank you!

    Read the article

  • HMVC or PAC - how to handle shared abstractions/models?

    - by fig-gnuton
    In HMVC/PAC, what's the recommended way to code if two or more triads/agents share a common model/abstraction? Do you instantiate a new instance of that model wherever needed, and propogate a change in one to all the other instances via the controllers? Or do instantiate one model at some common upper level, and inject that instance wherever needed? (Or neither if I'm missing something fundamental about these patterns?)

    Read the article

  • Would ViewModels fit in the Model View Presenter pattern?

    - by Jonn
    Having used ViewModels in MVC, I was wondering if applying the same to the MVP pattern is practical. I only have a few considerations, one being that MVP is already fairly hard to implement (with all the additional coding, not much on the seeming complexity) or that ViewModels already have a slightly similar way of modeling data or entities. Would adding another layer in the form of ViewModels be redundant or is it a logical abstraction that I, as one implementing the MVP pattern, should adhere to?

    Read the article

  • Solid Principle examples anywhere?

    - by user231465
    We all write code with some patterns even when we dont realise it. I am trying to really understand some of the solid principles and how you apply this principles in the real world. I am struggling with the "D" my understanding on Dependency Inversion I sometimes confuse with Dependency Injection is that as long as you keep things depending on abstraction (IE:interfaces) you are done. Has anybody got a small c# sample that explains it? thanks

    Read the article

  • How fast should an interpreted language be today?

    - by Tarbal
    Is speed of the (main/only viable) implementation of an interpreted programming language a criteria today? What would be the optimal balance between speed and abstraction? Should scripting languages completely ignore all thoughts about performance and just follow the concepts of rapid development, readability, etc.? I'm asking this because I'm currently designing some experimental languages and interpreters

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >