Q-BASIC AND VISUAL BASIC 6.0

12 отговора 307 прегледа
#1

Q-BASIC AND VISUAL BASIC 6.0

abe picove niakoj zanimaval li se e s tezi programi ako e taka moliavi pomognete malko ce nishto ne zacepvam a se opitvam da skalapim edna igricka probvah s edna programa DTA-G i s neia se sparviah tia e daje malko po prosta ot Q BASIC no ima bag i mnogo cesto se crashva are ako nqkoj razbira neshto ot tqh da pishe na [email protected] please ce sam na zor

znaci opitvam se igra da prava hora ako niakoi eposeshtaval [линк] ili [линк] znae kvo imam predvit no vse edno kajete kak da gi nauca teia ezici deeba

Отговор
в отговор на Maniac #2

Re: Q-BASIC AND VISUAL BASIC 6.0

QBasic е от времето на MS DOS 5.0 - 6.22 интерпретатор на BASIC програми за под дос
другото е за писане на програми за Win9x/NT/2000/XP(?)
общото е част от езика /BASIC/ и то замо на думи...

ако питаш как да ги научиш - по нормалния начин с писане и четене
обаче това няма да стане бързо - базика е кофти език, псевдо ОО и т.н.
ако бързаш - намери/наеми някой който е напред с материала

Отговор
в отговор на e-de #3

:-)))

Pseudo OO ? Mai samo na kartinka si go gledal VB :-))))

BTW, QBasic ima i compilator, no tova veche e BC 7 Professional.

На самотен остров
ще те намеря...
Отговор
в отговор на jamie #4

Re: :-)))

почнах от VB 3 та до сега - мъка, борба, два реда сълзи три реда с АК...
QBasic няма компилатор, навремето имаше Borland Turbo Basic, съвместим с QBasic-а в повечето случаи. по същото време имаше и Quick Basic /MS, мисля/ но незнам дали беше компилатор, май-да?
VB-то е мноо далеко от ОО програмирането
използването на готови обекти не е ОО програмиране

Редактирано от e-de на

Отговор
в отговор на e-de #5

Re: :-)))

Govorish naizust. Imam kompilatora u men. I sym rabotil s nego. Systia e kato QBasic, no ima bazi danni i koze da pravi exe-ta. A v momenta rabotata mi e tochno da PRAVIA clasove na VB. Ne da polzvam ... dobre li me chu ? :-))) Za tvoe svedenie OOP si e v reda na nestata i vav VB, vaprosa e che marzelite kato teb samo POLZVAT, a ne SAZDAVAT novi objects. Tova e problem na programmerite, ne na ezika....

На самотен остров
ще те намеря...
Отговор
в отговор на jamie #6

Re: :-)))

koj kompilator e uteb?
i ako ne ti e problem - pusni edno sorsche koeto demonstrira naslediavane na object vav VB, pls

Отговор
в отговор на e-de #7

Re: :-)))

има си компилатор за QBasic естествнно,например тук:
[линк]
VB си е баш ОО програмиране.Почти всички възможни класове си ги има и за това не се налага да се правят,когато пишеш за Windows,просто самата ОС е правена за VB и за това:) Пък и нови могат да се правят ако ти се наложи.

Отговор
в отговор на e-de #8

Re: :-)))

виж приятелю,
QBasic си има компилатор и то не лош. Версията, която се разпространява с DOS няма компилатор, естаствено, но вер. 4.50 има.
Освен това има и VBforDOS 1.0, който компилира и QB:)))
А това, че VB e слаб и не е ОО, го разказват само хора, който не го познават...
VB3 е доста стар и е 16 раз., но новите версии са отлични за бизнес -риложения и работа с БД.
Това с наследяването не е съвсем точно...Всеки обект може да съдържа др. и т.н... Просто нещата се реализират по различен начин...
Слабото място на VB е графиката...

ако някой се интервсъва от езика, по-точно VB6: millenkn2@abv.bg

Отговор
в отговор на mlln #9

Re: :-)))

Amiiiii !!!
S biblioteki za OpenGL i Direct X izobsto ne e zle ! E, po-baven e ot C, razbira se :-))))
To i C polzva takiva biblioteki, da ne mislish che e razlichno ? :-)))

На самотен остров
ще те намеря...
Отговор
в отговор на mlln #10

Re: :-)))

QBasic 4.50 може и да има компилатор - когато споменах за компилатори имах предвид DOS-овската версия
след VB3 минах на 4,5 сега съм на v6. освен това пиша ASP-та и VBA неща. което ще рече че имам известна представа за това какво може и какво неможе VB... /имам предвид къде си струва да се прилага и къде е добре да се пише на друг език/

това с наследяването си е съвсем точно - ОО езици го могат, VB, мисля, не
какво може да съдържа един обект е общо взето ясно - полета /не с мак/, методи, събития и свойства /fields, methods, events, properties/.
което ще рече че чакам да видя код на VB (версия - поизбор) който демонстрира наследяване на обект

Отговор
в отговор на sl #11

Re: :-)))

както вече писах - чакам да видя...
ама няма да дочакам...

изказването
Почти всички възможни класове си ги има...
е меко казано глупост, но да приемем че е заяждане на дребно...
ако съдя от броя класове които аз съм написал, то това което предлага Windows-a не е никак достатъчно.

Отговор
в отговор на e-de #12

Re: :-)))

наследяването има 2 аспекта,
наследяване на интерфейс и наследяване на имплементацията.
вб може да наследява интерфейс, но не и имплементация на клас.
доколкото знам версия 7 го може и това

Пламен
Отговор
в отговор на e-de #13

Re: :-)))

O, napisal si poveche klasove ot tezi v Windows ? O, BOZE na vsichki bogove, kolko zivota go pisa tova ? :-))))

Sorry, ne znaeh che oste chaklash za kod ! Eto malko parcheta ot MSDN :-)))

Note Users of C++ or other object-oriented programming languages are used to seeing class hierarchies. A class hierarchy describes inheritance. That is, it shows how objects are derived from simpler objects, inheriting their behavior. By contrast, object models are hierarchies that describe containment. That is, they show how complex objects like Worksheets contain collections of other objects, such as Button, Picture, and PivotTable® objects. Object models can be created with Visual Basic, Visual C++, and other tools that support COM and ActiveX.






Most object-oriented programming systems provide polymorphism through inheritance. That is, the hypothetical Flea and Tyrannosaur classes might both inherit from an Animal class. Each class would override the Animal class's Bite method, in order to provide its own bite characteristics.

The polymorphism comes from the fact that you could call the Bite method of an object belonging to any class that derived from Animal, without knowing which class the object belonged to.

Providing Polymorphism with Interfaces
Visual Basic doesn't use inheritance to provide polymorphism. Visual Basic provides polymorphism through multiple ActiveX interfaces. In the Component Object Model (COM) that forms the infrastructure of the ActiveX specification, multiple interfaces allow systems of software components to evolve without breaking existing code.

An interface is a set of related properties and methods. Much of the ActiveX specification is concerned with implementing standard interfaces to obtain system services or to provide functionality to other programs.

In Visual Basic, you would create an Animal interface and implement it in your Flea and Tyrannosaur classes. You could then invoke the Bite method of either kind of object, without knowing which kind it was.

Polymorphism and Performance
Polymorphism is important for performance reasons. To see this, consider the following function:

Public Sub GetFood(ByVal Critter As Object, _
ByVal Food As Object)
Dim dblDistance As Double
' Code to calculate distance to food (omitted).
Critter.Move dblDistance ' Late bound
Critter.Bite Food ' Late bound
End Sub

The Move and Bite methods are late bound to Critter. Late binding happens when Visual Basic can't determine at compile time what kind of object a variable will contain. In this example, the Critter argument is declared As Object, so at run time it could contain a reference to any kind of object — like a Car or a Rock.

Because it can't tell what the object will be, Visual Basic compiles some extra code to ask the object if it supports the method you've called. If the object supports the method, this extra code invokes it; if not, the extra code raises an error. Every method or property call incurs this additional overhead.

By contrast, interfaces allow early binding. When Visual Basic knows at compile time what interface is being called, it can check the type library to see if that interface supports the method. Visual Basic can then compile in a direct jump to the method, using a virtual function table (vtable). This is many times faster than late binding.

Now suppose the Move and Bite methods belong to an Animal interface, and that all animal classes implement this interface. The Critter argument can now be declared As Animal, and the Move and Bite methods will be early bound:

Public Sub GetFood(ByVal Critter As Animal, _
ByVal Food As Object)
Dim dblDistance As Double
' Code to calculate distance to food (omitted).
Critter.Move dblDistance ' Early bound (vtable).
Critter.Bite Food ' Early bound (vtable).
End Sub

For More Information "Creating and Implementing an Interface" creates an Animal interface and implements it in Flea and Tyrannosaur classes.







One of the most striking features of the Component Object Model (COM) is the ability of an object to implement multiple interfaces. In addition to enabling polymorphism, multiple interfaces provide a mechanism for incremental or evolutionary development, without the need to recompile all the components in the system when changes occur.

By defining features in terms of interfaces, composed of small groups of closely-related functions, you can implement component features as needed, knowing that you can expand them later by implementing additional interfaces.

Maintaining compatibility is simplified, because new versions of a component can continue to provide existing interfaces, while adding new or enhanced interfaces. Succeeding versions of client applications can take advantage of these when it makes sense for them to do so.

Inheritance and Polymorphism
As explained in "Polymorphism" in "Programming with Objects," in the Visual Basic Programmer’s Guide, most object-oriented programming tools provide polymorphism through inheritance. This is a powerful mechanism for small-scale development tasks, but has generally proven to be problematic for large-scale systems.

In part, these difficulties arise as a result of necessary changes to classes deep in the inheritance tree. Recompilation is required in order to take advantage of such changes, and failure to recompile may lead to unpleasant surprises when the time finally arrives for a new version.

More seriously, an over-emphasis on inheritance-driven polymorphism typically results in a massive shift of resources from development tasks to up-front design tasks, doing nothing to address development backlogs or to shorten the time before the end user can discover — through hands-on experience — whether the system actually fulfills the intended purpose.

As a consequence, tools for rapid prototyping and Rapid Application Development (RAD) have gained wider acceptance than OOP tools.

Visual Basic and COM
Visual Basic follows the COM example, emphasizing multiple interfaces as a more flexible way to provide polymorphism. Software can evolve interface by interface, rather than having to be derived from all necessary antecedents during a lengthy design process.

Objects can begin small, with minimal functionality, and over time acquire additional features, as it becomes clear from actual use what those features should be. Legacy code is protected by continuing to support old interfaces while implementing new ones.

The Implements Feature
Visual Basic provides the Implements keyword as the means for incorporating a secondary interface. For example, if your project had a reference to a type library that described the IFinance interface, you could place the following code in a class module:

Implements IFinance

Because type libraries contain only interfaces, and no implementation, you would then add code for each of the properties and methods of the IFinance interface, as described in "Implementing and Using Standard Interfaces."

An Interface is a Contract
When you create an interface for use with Implements, you’re casting it in concrete for all time. This interface invariance is an important principle of component design, because it protects existing systems that have been written to an interface.

When an interface is clearly in need of enhancement, a new interface should be created. This interface might be called Interface2, to show its relationship to the existing interface.

While generating new interfaces too frequently can bulk up your components with unused interfaces, well-designed interfaces tend to be small and independent of each other, reducing the potential for performance problems.

Factoring Interfaces
The process of determining what properties and methods belong on an interface is called factoring.

In general, you should group a few closely-related functions on an interface. Too many functions make the interface unwieldy, while dividing the parts of a feature too finely results in extra overhead. For example, the following code calls methods on three different interfaces of the Velociraptor class:

Public Sub CretaceousToDoList(ByVal vcr1 As _
Velociraptor, ByVal vcr2 As Velociraptor)
Dim dnr As IDinosaur
Dim prd As IPredator
vcr1.Mate vcr2
Set dnr = vcr1
dnr.LayEggs
Set prd = vcr1
prd.KillSomethingAndEatIt
End Sub

In order to use methods on the IDinosaur and IPredator interfaces, you must assign the object to a variable of the correct interface type.

Where possible, interfaces designed to use flexible data structures will outlast interfaces based on fixed data types.

As noted above, it’s much harder to go wrong in designing interfaces than in creating large inheritance trees. If you start small, you can have parts of a system running relatively quickly. The ability to evolve the system by adding interfaces allows you to gain the advantages object-oriented programming was intended to provide.


I nakraia - seriozno. VB ne e C, nito Java. Estestveno che ne e UNIVERSALEN ezik i ako ste se izmachvam da pisha na C++ sys sintaxisa na VB - niama da stane. No e dostatychno dobar za povecheto sluchai, a e mnogo po-byrzo razrabotvaneto pod nego - dnes veche tova e nai-vaznoto za edin proekt.... za sazalenie


Bye za sega, CU later !

На самотен остров
ще те намеря...
Отговор