Search Results

Search found 30234 results on 1210 pages for 'object oriented'.

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

  • How can I explain object-oriented programming to someone who's only coded in Fortran 77?

    - by Zonedabone
    My mother did her college thesis in Fortran, and now (over a decade later) needs to learn c++ for fluids simulations. She is able to understand all of the procedural programming, but no matter how hard I try to explain objects to her, it doesn't stick. (I do a lot of work with Java, so I know how objects work) I think I might be explaining it in too high-level ways, so it isn't really making sense to someone who's never worked with them at all and grew up in the age of purely procedural programming. Is there any simple way I can explain them to her that will help her understand?

    Read the article

  • Is there an alternative to the term "calling object"?

    - by ybakos
    Let's suppose you've got a class defined (in pseudocode): class Puppy { // ... string sound = "Rawr!"; void bark() { print(sound); } } And say, given a Puppy instance, you call it's bark() method: Puppy p; p.bark(); Notice how bark() uses the member variable sound. In many contexts, I've seen folks describe sound as the member variable of the "calling object." My question is, what's a better term to use than "calling object?" To me, the object is not doing any calling. We know that member functions are in a way just functions with an implicit this or self parameter. I've come up with "receiving object," or "message recipient," which makes sense if you're down with the "messaging" paradigm. Do any of you happy hackers have a term that you like to use? I feel it should mean "the object upon which a method is called" and TOUWAMIC just doesn't cut it.

    Read the article

  • APress deal of the day 13/Sep/2012 - Beginning C# Object-Oriented Programming

    - by TATWORTH
    Today's $10 deal of the day from APress at http://www.apress.com/9781430235309 is Beginning C# Object-Oriented Programming"Beginning C# Object-Oriented Programming brings you into the modern world of development, as you master the fundamentals of programming with C# and learn to develop efficient, reusable, elegant code through the object-oriented programming (OOP) methodology."  Here is a summary of my earlier review:This is a good book to learn C# by doing something practical. The book provides an excellent series of hands-on activities.So should you get a copy for your trainee C# programmers? Yes!Do I recommend it for people learning C# 2010 on their own? Yes!Those of you who have written to me for training in C# (assuming the messages were not from BOTS!), should you buy this book - YES!

    Read the article

  • SQL SERVER – Error: Fix – Msg 208 – Invalid object name ‘dbo.backupset’ – Invalid object name ‘dbo.backupfile’

    - by pinaldave
    Just a day before I got a very interesting email. Here is the email (modified a bit to make it relevant to this blog post). “Pinal, We are facing a very strange issue. One of our query  related to backup files and backup set has stopped working suddenly in SSMS. It works fine in application where we have and in the stored procedure but when we have it in our SSMS it gives following error. Msg 208, Level 16, State 1, Line 1 Invalid object name ‘dbo.backupfile’. Here are our queries which we are trying to execute. SELECT name, database_name, backup_size, TYPE, compatibility_level, backup_set_id FROM dbo.backupset; SELECT logical_name, backup_size, file_type FROM dbo.backupfile; This query gives us details related to backupset and backup files when the backup was taken.” When I receive this kind of email, usually I have no answers directly. The claim that it works in stored procedure and in application but not in SSMS gives me no real data. I have requested him to very first check following two things: If he is connected to correct server? His answer was yes. If he has enough permissions? His answer was he was logged in as an admin. This means there was something more to it and I requested him to send me a screenshot of the his SSMS. He promptly sends that to me and as soon as I receive the screen shot I knew what was going on. Before I say anything take a look at the screenshot yourself and see if you can figure out why his queries are not working in SSMS. Just to make your life a bit easy, I have already given a hint in the image. The answer is very simple, the context of the database is master database. To execute above two queries the context of the database has to be msdb. Tables backupset and backupfile belong to the database msdb only. Here are two workaround or solution to above problem: 1) Change context to MSDB Above two queries when they will run as following they will not error out and will give the accurate desired result. USE msdb GO SELECT name, database_name, backup_size, TYPE, compatibility_level, backup_set_id FROM dbo.backupset; SELECT logical_name, backup_size, file_type FROM dbo.backupfile; 2) Prefix the query with msdb There are cases above script used in stored procedure or part of big query, it is not possible to change the context of the whole query to any specific database. Use three part naming convention and prefix them with msdb. SELECT name, database_name, backup_size, TYPE, compatibility_level, backup_set_id FROM msdb.dbo.backupset; SELECT logical_name, backup_size, file_type FROM msdb.dbo.backupfile; Very simple solution but sometime keeps people wondering for an answer. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • How to make this OO?

    - by John
    Hello, Sorry for the poor title,I'm new to OOP so I don't know what is the term for what I need to do. I have, say, 10 different Objects that inherit one Object.They have different amount and type of class members,but all of them have one property in common - Visible. type TObj1=class(TObject) private a:integer; ...(More members) Visible:Boolean; end; TObj2=class(TObject) private b:String; ...(More members) Visible:Boolean; end; ...(Other 8 objects) For each of them I have a variable. var Obj1:TObj1; Obj2:TObj2; Obj3:TObj3; ....(Other 7 objects) Rule 1: Only one object can be initialized at a time(others have to be freed) to be visible. For this rule I have a global variable var CurrentVisibleObj:TObject; //Because they all inherit TObject Finally there is a procedure that changes visibility. procedure ChangeObjVisibility(newObj:TObject); begin CurrentVisibleObj.Free; //Free the old object CurrentVisibleObj:=newObj; //assign the new object CurrentVisibleObj:= ??? //Create new object CurrentVisibleObj.Visible:=true; //Set visibility to new object end; There is my problem,I don't know how to initialize it,because the derived class is unknown. How do I do this? I simplified the explanation,in the project there are TFrames each having different controls and I have to set visible/not visible the same way(By leaving only one frame initialized). Sorry again for the title,I'm very new to OOP.

    Read the article

  • Questioning the motivation for dependency injection: Why is creating an object graph hard?

    - by oberlies
    Dependency injection frameworks like Google Guice give the following motivation for their usage (source): To construct an object, you first build its dependencies. But to build each dependency, you need its dependencies, and so on. So when you build an object, you really need to build an object graph. Building object graphs by hand is labour intensive (...) and makes testing difficult. But I don't buy this argument: Even without dependency injection, I can write classes which are both easy to instantiate and convenient to test. E.g. the example from the Guice motivation page could be rewritten in the following way: class BillingService { private final CreditCardProcessor processor; private final TransactionLog transactionLog; // constructor for tests, taking all collaborators as parameters BillingService(CreditCardProcessor processor, TransactionLog transactionLog) { this.processor = processor; this.transactionLog = transactionLog; } // constructor for production, calling the (productive) constructors of the collaborators public BillingService() { this(new PaypalCreditCardProcessor(), new DatabaseTransactionLog()); } public Receipt chargeOrder(PizzaOrder order, CreditCard creditCard) { ... } } So dependency injection may really be an advantage in advanced use cases, but I don't need it for easy construction and testability, do I?

    Read the article

  • Object Oriented Design Questions

    - by Robert
    Hello there. I am going to develop a Tic-Tac-Toe game using Java(or maybe other OO Languages).Now I have a picture in my mind about the general design. Interface: Player ,then I will be able to implement a couple of Player classes,based on how I want the opponent to be,for example,random player,intelligent player. Classes: Board class,with a two-dimensional array of integers,0 indicates open,1 indicates me,-1 indicates opponent.The evaluation function will be in here as well,to return the next best move based on the current board arrangement and whose turn it is. Refree class,which will create instance of the Board and two player instances,then get the game begin. This is a rough idea of my OO design,could anybody give me any critiques please,I find this is really beneficial,thank you very much.

    Read the article

  • How to make an object stay relative to another object

    - by Nick
    In the following example there is a guy and a boat. They have both a position, orientation and velocity. The guy is standing on the shore and would like to board. He changes his position so he is now standing on the boat. The boat changes velocity and orientation and heads off. My character however has a velocity of 0,0,0 but I would like him to stay onboard. When I move my character around, I would like to move as if the boat was the ground I was standing on. How do keep my character aligned properly with the boat? It is exactly like in World Of Warcraft, when you board a boat or zeppelin. This is my physics code for the guy and boat: this.velocity.addSelf(acceleration.multiplyScalar(dTime)); this.position.addSelf(this.velocity.clone().multiplyScalar(dTime)); The guy already has a reference to the boat he's standing on, and thus knows the boat's position, velocity, orientation (even matrices or quaternions can be used).

    Read the article

  • How to apply Data Oriented Design with Object Oriented Programming?

    - by Pombal
    I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes. I saw this too but didn't help much: http://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface

    Read the article

  • Aspect Oriented Programming Library/Framework for Actionscript 3?

    - by Tom
    I'm looking for a full featured AOP Library for Actionscript 3. The following projects I noticed so far, but they all seem to have their problems: - http://farmcode.org/page/Sodality.aspx (looks most promising so far, however it requires you to create a whole new class for every AOP "call" I believe, and it forces you to follow quite a lot of restrictions, anyone has experience with it? - http://code.google.com/p/loom-as3/ (this one is discontinued) - http://code.google.com/p/floxy/ (dynamic proxy generation? this isn't really AOP as I know it, right?) - http://code.google.com/p/flemit/ (dynamic byte code generation? this is something AOP needs I think, but not the full featured AOP framework I am looking for) Does anyone know of a better solution? Or does anyone have any experiences with AOP in Actionscript 3? Best regards, Tom

    Read the article

  • How to play the sound of an object sliding on another object for a variable duration

    - by Antoine
    I would like to add sound effects to a basic 2D game. For example, a stone sphere is rolling on wood surface. Let's say I have a 2 second audio recording of this. How could I use the sample to add sound for an arbitrary duration ? So far I have two solutions in mind: a/ record the sound for an amount of time that is greater than the maximum expected duration, and play only a part of it; b/ extract a small portion of the sample and play it in a loop for the duration of the move; however I'm not sure if it makes sense with an audio wave.

    Read the article

  • PHP Object Oriented Web Application

    - by Sev
    I have a class called "Layout" for the layout of the page, another class called "User" for the user. Every page I create, I instantiate a new Layout. When a user logs in, there is a new User instantiated. How do I get an instance of the layout class to know about the instantiated user? I could also save the entire instance of the User in a session variable. I assume that's a bad idea though. What are the best practices for this?

    Read the article

  • How does Object Oriented Programming work?

    - by venom
    Hello, I am not sure about some things in OOP. If I have Class1, which has some private field, for example private Field field1, and make getField1 () { return field1; } then I have some class with constructor public Class2 (Field field) { someMethod(field); } And then I call constructor of Class2 in Class3 like: Class2 cl = new Class2(instanceOfClass1.getField1()); And now the question: Am I working with field1 of instanceOfClass1 in someMethod(field)?

    Read the article

  • Object Oriented vs Relational Databases

    - by Dan
    Objects oriented databases seem like a really cool idea to me, no need to worry about mapping your domain model to your database model, no messing around with sql or ORM tools. The way I understand it, relational DBs offer some advantages when there is massive amounts of data, and searching an indexing need to be done. To my mind 99% of websites are not massive, and enterprise issues never need to be thought about, so why arn't OO DBs more widely used?

    Read the article

  • PHP: How do I access child properties from a method in a base object?

    - by Nick
    I'd like for all of my objects to be able to return a JSON string of themselves. So I created a base class for all of my objects to extend, with an AsJSON() method: class BaseObject { public function AsJSON() { $JSON=array(); foreach ($this as $key = $value) { if(is_null($value)) continue; $JSON[$key] = $value; } return json_encode($JSON); } } And then extend my child classes from that: class Package extends BaseObject { ... } So in my code, I expect to do this: $Box = new Package; $Box-SetID('123'); $Box-SetName('12x8x6'); $Box-SetBoxX('12'); $Box-SetBoxY('8'); $Box-SetBoxZ('6'); echo $Box-AsJSON(); But the JSON string it returns only contains the BaseClass's properties, not the child properties. How do I modify my AsJSON() function so that $this refers to the child's properties, not the parent's?

    Read the article

  • Save object using variable with object name

    - by FBE
    I'm wondering what an easy way is to save an object in R, using a variable objectName with the name of the object to be saved. I want this to easy save objects, with their name in the file name. I tried to use get, but I didn't manage to save the object with it's original object name. Example: If I have the object called "temp", which I want to save in the directory "dataDir". I put the name of the object in the variable "objectName". Attempt 1: objectName<-"temp" save(get(objectName), file=paste(dataDir, objectName, ".RData", sep="")) load(paste(dataDir, objectName, ".RData", sep="")) This didn't work, because R tries to save an object called get(objectName), instead of the result of this call. So I tried the following: Attempt 2: objectName<-"temp" object<-get(objectName) save(object, file=paste(dataDir, objectName, ".RData", sep="")) load(paste(dataDir, objectName, ".RData", sep="")) This obviously didn't work, because R saves the object with name "object", and not with name "temp". After loading I have a copy of "object", instead of "temp". (Yes, with the same contents...but that is not what I want :) ). So I thought it should be something with pointers. So tried the following: Attempt 3: objectName<-"temp" object<<-get(objectName) save(object, file=paste(dataDir, objectName, ".RData", sep="")) load(paste(dataDir, objectName, ".RData", sep="")) Same result as attempt 2. But I'm not sure I'm doing what I think I'm doing. What is the solution for this?

    Read the article

  • Service-Oriented Architecture and Web Services

    Service oriented architecture is an architectural model for developing distributed systems across a network or the Internet. The main goal of this model is to create a collection of sub-systems to function as one unified system. This approach allows applications to work within the context of a client server relationship much like a web browser would interact with a web server. In this relationship a client application can request an action to be performed on a server application and are returned to the requesting client. It is important to note that primary implementation of service oriented architecture is through the use of web services. Web services are exposed components of a remote application over a network. Typically web services communicate over the HTTP and HTTPS protocols which are also the standard protocol for accessing web pages on the Internet.  These exposed components are self-contained and are self-describing.  Due to web services independence, they can be called by any application as long as it can be accessed via the network.  Web services allow for a lot of flexibility when connecting two distinct systems because the service works independently from the client. In this case a web services built with Java in a UNIX environment not will have problems handling request from a C# application in a windows environment. This is because these systems are communicating over an open protocol allowed by both environments. Additionally web services can be found by using UDDI. References: Colan, M. (2004). Service-Oriented Architecture expands the vision of web services, Part 1. Retrieved on August 21, 2011 from http://www.ibm.com/developerworks/library/ws-soaintro/index.html W3Schools.com. (2011). Web Services Introduction - What is Web Services. Retrieved on August 21, 2011 from http://www.w3schools.com/webservices/ws_intro.asp

    Read the article

  • Does command/query separation apply to a method that creates an object and returns its ID?

    - by Gilles
    Let's pretend we have a service that calls a business process. This process will call on the data layer to create an object of type A in the database. Afterwards we need to call again on another class of the data layer to create an instance of type B in the database. We need to pass some information about A for a foreign key. In the first method we create an object (modify state) and return it's ID (query) in a single method. In the second method we have two methods, one (createA) for the save and the other (getId) for the query. public void FirstMethod(Info info) { var id = firstRepository.createA(info); secondRepository.createB(id); } public void SecondMethod(Info info) { firstRepository.createA(info); var key = firstRepository.getID(info); secondRepository.createB(key); } From my understanding the second method follows command query separation more fully. But I find it wasteful and counter-intuitive to query the database to get the object we have just created. How do you reconcile CQS with such a scenario? Does only the second method follow CQS and if so is it preferable to use it in this case?

    Read the article

  • If an entity is composed, is it still a god object?

    - by Telastyn
    I am working on a system to configure hardware. Unfortunately, there is tons of variety in the hardware, which means there's a wide variety of capabilities and configurations depending on what specific hardware the software connects to. To deal with this, we're using a Component Based Entity design where the "hardware" class itself is a very thin container for components that are composed at runtime based on what capabilities/configuration are available. This works great, and the design itself has worked well elsewhere (particularly in games). The problem is that all this software does is configure the hardware. As such, almost all of the code is a component of the hardware instance. While the consumer only ever works against the strongly typed interfaces for the components, it could be argued that the class that represents an instance of the hardware is a God Object. If you want to do anything to/with the hardware, you query an interface and work with it. So, even if the components of an object are modular and decoupled well, is their container a God Object and the downsides associated with the anti-pattern?

    Read the article

  • Possible to add an EventListener to a function for Actionscript 3?

    - by Tom
    I'm trying to setup something like Aspect Oriented Programming in Actionscript 3, basically the only thing I need to be able to do is something like this: SomeClass.getMethod("methodName").addEventListener(afterMethodExecuted, function() { //run code }); This way I can run code after (or before) any method in any class has run, allowing numerous new possibilities. How should I implement this?

    Read the article

  • Telerik Object reference not set to an instance of an object

    - by Duncan
    Hi, I have a main form which contains multiple worker threads. These threads raise events which update Telerik controls on the main form. The event handlers contain code which check if InvokeRequired and BeginInvoke where required. At random interval I am receiving the following exception, and have no idea on how where to find this? I was wondering if the following is understandable to anyone to point me in the right direction. Thanks in advance System.Reflection.TargetInvocationException was unhandled Message="Exception has been thrown by the target of an invocation." Source="mscorlib" StackTrace: at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbacks() at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at Telerik.WinControls.UI.RadStatusStrip.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at MyFX.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.NullReferenceException Message="Object reference not set to an instance of an object." Source="Telerik.WinControls" StackTrace: at Telerik.WinControls.Layouts.ContextLayoutManager.LayoutQueue.RemoveOrphans(RadElement parent) at Telerik.WinControls.Layouts.ContextLayoutManager.LayoutQueue.Add(RadElement e) at Telerik.WinControls.RadElement.InvalidateArrange(Boolean recursive) at Telerik.WinControls.RadElement.InvalidateArrange() at Telerik.WinControls.RadElement.Measure(SizeF availableSize) at Telerik.WinControls.Layouts.ImageAndTextLayoutPanel.MeasureOverride(SizeF availableSize) at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize) at Telerik.WinControls.RadElement.Measure(SizeF availableSize) at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout() at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)

    Read the article

  • Should I pass an object into a constructor, or instantiate in class?

    - by Prisoner
    Consider these two examples: Passing an object to a constructor class ExampleA { private $config; public function __construct($config) { $this->config = $config; } } $config = new Config; $exampleA = new ExampleA($config); Instantiating a class class ExampleB { private $config; public function __construct() { $this->config = new Config; } } $exampleA = new ExampleA(); Which is the correct way to handle adding an object as a property? When should I use one over the other? Does unit testing affect what I should use?

    Read the article

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